Ticket #7 (assigned defect)

Opened 5 years ago

Last modified 5 years ago

Merge projection dictionaries from different modules.

Reported by: benl Owned by: erikd
Priority: blocker Milestone: 0.1.3
Component: Source Desugarer Version: 0.1.2
Keywords: Cc:

Description

Projection dictionaries are open, so we should be able to give instance functions in multiple modules.

Change History

Changed 5 years ago by benl

  • milestone changed from _|_ to 0.1.4

Changed 5 years ago by benl

Test is T7-MergeProjDictionaries

With

module Main where
import Foo

project List where 
	rrev xx = reverse xx

main ()
 = do	putStr $ show $ [1, 2, 3] .rrev
	putStr $ show $ [1, 2, 3] .count
module Foo where

project List where
	count = length

we get

ddc: ERROR
./test/Broken-skip/T7-MergeProjDictionaries/Foo.di:29:15
     Redefined value variable 'Foo.project_List_x'
      first defined at: ./library/Data/List.di:65:15

./test/Broken-skip/T7-MergeProjDictionaries/Foo.di:35:15
     Redefined value variable 'Foo.project_List_xs'
      first defined at: ./library/Data/List.di:71:15

...

Compiler tries to generate new default projections in the Foo module, which conflict with the original ones in Data.List. We should only generate the default projections in the module that defines the data type, not the projection dictionary.

Changed 5 years ago by erikd

  • owner set to erikd
  • status changed from new to assigned

Changed 5 years ago by benl

The symtoms for this test have changed slightly due to recent changes in the renamer.

In Foo.di we have

foreign import project_List_x
        :: forall Data.List.t0 %r0
        .  Data.List.List %r0 Data.List.t0 -(!e0)> Data.List.t0
        :- !e0        = Base.!Read %r0
        :$ Base.Data -> Base.Obj;

Note that Data.List.t0 is fully qualified, which causes a parse error. It's been fully qualified by the exporter because the function was defined in the Data.List module instead of the Foo module. Although the test dies due to the parse error, the real problem is that Foo.di should not re-export functions that were defined in Data.List.

If, in Foo.ds we add projections to the List type, then only the sigs for these new projections should appear in Foo.di, not all the others from Data/List.ds as well.

Changed 5 years ago by erikd

This ticket can't be fixed until #168 is fixed.

Changed 5 years ago by erikd

  • milestone changed from 0.1.4 to 0.1.3

Changed 5 years ago by erikd

  • priority changed from normal to blocker
Note: See TracTickets for help on using tickets.