Opened 10 years ago

Closed 6 years ago

#79 closed defect (fixed)

Kind inference checking problem for mutable tuples

Reported by: benl Owned by:
Priority: normal Milestone: 0.3.0
Component: Source Type Inferencer Version: 0.1.2
Keywords: Cc:

Description

Added by Jared

The following function fails to compile.

example :: (Int, Int) %r0
        :- Mutable %r0
example = (0,0)

The error message is

ddc: src/Source/Desugar.hs:(647,4)-(670,28): Non-exhaustive patterns in case

The same error occurs if the region is placed before the type.

Change History (7)

comment:1 Changed 10 years ago by benl

This should be a parse error. To give the type of a mutable tuple use:

example :: Tuple2 %r0 Int Int 
        :- Mutable %r0

I'm not sure if we should support the sugar:

  (Int, Int) %r0

because the arguments are in the wrong order..

comment:2 Changed 9 years ago by erikd

On the mailing list Ben said:

    This test really does have a kind error.

    With

       example :: (Int, Int) %r0
            :- Mutable %r0
       example = ( 0,0)


    compiling with -dump-desugar shows it gets desugared to:

    [Test.example]
           :: (Data.Tuple.Tuple2 Base.Int32 Base.Int32) %r0
            :- Base.Mutable %r0;

    Test.example
     =      Data.Tuple.Tuple2 (0i32) (0i32);


    And the expression:
    (Data.Tuple.Tuple2 Base.Int32 Base.Int32) %r0

    after type elaboration turns into:
   (Data.Tuple.Tuple2 %r1 (Base.Int32 %r2) (Base.Int32 %r3)) %r0

    This is miskinded, because Tuple2 has an extra region argument (%r0)

    .. so the bug is really another instance of DDC lacking proper kind
    inference / checking, and is related to #68.

comment:3 Changed 9 years ago by erikd

  • Component changed from Source Parser to Source Type Inferencer

comment:4 Changed 9 years ago by erikd

  • Summary changed from Parser problems for mutable tuples to Kind inference checking problem for mutable tuples

comment:5 Changed 8 years ago by benl

  • Priority changed from blocker to normal

comment:6 Changed 7 years ago by benl

  • Milestone 0.1.4 deleted

Milestone 0.1.4 deleted

comment:7 Changed 6 years ago by benl

  • Milestone set to 0.3.0
  • Resolution set to fixed
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.