brownplt / pyret-lang

The Pyret language.
Other
1.07k stars 109 forks source link

(Type checker) else in cases causes an internal error #1263

Closed sorawee closed 6 years ago

sorawee commented 6 years ago
cases (List) empty:
  | empty => 1
  | else => 2
end

produces

Expected to get 6 arguments when calling the function at
builtin://ast:716:2-724:7 at (builtin://ast:716:2-724:7)

from
<builtin undefined> at (<builtin undefined>)

but got these 5 arguments:

srcloc(

    "definitions://", 
    1, 
    0, 
    0, 
    4, 
    3, 
    52

)

a-name(

    srcloc(

        "definitions://", 
        1, 
        7, 
        7, 
        1, 
        11, 
        11

    ), 
    List53

)

s-id(

    srcloc(

        "definitions://", 
        1, 
        13, 
        13, 
        1, 
        18, 
        18

    ), 
    empty23

)

[list:

    s-singleton-cases-branch(

        srcloc(

            "definitions://", 
            2, 
            2, 
            22, 
            2, 
            14, 
            34

        ), 
        srcloc(

            "definitions://", 
            2, 
            4, 
            24, 
            2, 
            9, 
            29

        ), 
        "empty", 
        s-num(

            srcloc(

                "definitions://", 
                2, 
                13, 
                33, 
                2, 
                14, 
                34

            ), 
            1

        )

    )

]

s-num(

    srcloc(

        "definitions://", 
        3, 
        12, 
        47, 
        3, 
        13, 
        48

    ), 
    2

)

One or more internal errors prevented us from showing the best error message possible. Please report this as a bug.
blerner commented 6 years ago

@mkolosick looks like a simple error that https://github.com/brownplt/pyret-lang/blob/master/src/arr/compiler/type-check.arr#L1294 is missing a final boolean blocky argument.