Ticket #44 (new defect)

Opened 6 years ago

Last modified 5 years ago

Fix elaboration of recursive data types.

Reported by: benl Owned by:
Priority: project Milestone:
Component: Source Type Inferencer Version:
Keywords: Cc:

Description

At the moment, data type definitions to be elaborated must be in-order and not recursive. For example:

data Foo a 
  = FooInt Int

data Bar a 
  = BarFoo Foo

The definition for Bar must come after def for Foo, otherwise Source.Desugar won't have the correct kind for it. Should probably tie this elaboration to kind inference.

Change History

Changed 6 years ago by benl

If we put them the other way around

data Bar a 
  = BarFoo Foo

data Foo a 
  = FooInt Int

Then we get an silent, malkinded type expression in the .di file.

data Bar %rDK3 a
        = BarFoo {
                Main.Foo %rDK3;   <--- bad kind
        };

data Foo %rDK4 a
        = FooInt {
                Base.Int32 %rDK4;
        };

Test is T44-DataTypeOrder

Changed 5 years ago by benl

  • type changed from task to defect
  • summary changed from Redo data type elaboration and kind inference. to Fix elaboration of recursive data types.
Note: See TracTickets for help on using tickets.