Play

Check-in [07dba377f5]
Login
Overview
Comment:Add unit test that reproduces current typechecking bug with stdlib.
Timelines: family | ancestors | descendants | both | stdlib
Files: files | file ages | folders
SHA3-256: 07dba377f50d171541e66eafb72d83e31b4eb26fe967e9e7cb281643889afd62
User & Date: robin.hansen on 2021-04-11 10:07:21
Other Links: branch diff | manifest | tags
Context
2021-04-13
13:58
Instead of inferring types of each branch in a multi-fn and compare the results to type annotation, ... check-in: 76d7054f19 user: robin.hansen tags: stdlib
2021-04-11
10:07
Add unit test that reproduces current typechecking bug with stdlib. check-in: 07dba377f5 user: robin.hansen tags: stdlib
09:20
Union members of custom types were not properly qualified. check-in: a45999dbcb user: robin.hansen tags: stdlib
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Modified tests/Test/TypeChecker.elm from [7ab0558be9] to [e9183c444f].

1088
1089
1090
1091
1092
1093
1094




















































1095
1096
1097
1098
1099
1100
1101
                                            QAST.SoloImpl
                                                [ QAST.Integer emptyRange 1
                                                , QAST.Builtin emptyRange Builtin.Minus
                                                ]
                                      }
                                    ]
                            }




















































                    in
                    case run input of
                        Ok _ ->
                            Expect.pass

                        Err _ ->
                            Expect.fail "Did not expect type check to fail."







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
                                            QAST.SoloImpl
                                                [ QAST.Integer emptyRange 1
                                                , QAST.Builtin emptyRange Builtin.Minus
                                                ]
                                      }
                                    ]
                            }
                    in
                    case run input of
                        Ok _ ->
                            Expect.pass

                        Err _ ->
                            Expect.fail "Did not expect type check to fail."
            , test "Typechecking involving a multi-arity quotation is fine _if_ arity info is in type annotation" <|
                \_ ->
                    let
                        input =
                            { types = Dict.empty
                            , words =
                                Dict.fromListBy .name
                                    [ { name = "apply-to-nums"
                                      , metadata =
                                            Metadata.default
                                                |> Metadata.withType
                                                    [ Type.Quotation
                                                        { input = [ Type.Int, Type.Int ]
                                                        , output = [ Type.Int ]
                                                        }
                                                    ]
                                                    [ Type.Int ]
                                      , implementation =
                                            QAST.SoloImpl
                                                [ QAST.Integer emptyRange 1
                                                , QAST.Integer emptyRange 2
                                                , QAST.Builtin emptyRange Builtin.Apply
                                                ]
                                      }
                                    , { name = "main"
                                      , metadata =
                                            Metadata.default
                                                |> Metadata.asEntryPoint
                                      , implementation =
                                            QAST.SoloImpl
                                                [ QAST.WordRef emptyRange "main__quot1"
                                                , QAST.Word emptyRange "apply-to-nums"
                                                ]
                                      }
                                    , { name = "main__quot1"
                                      , metadata =
                                            Metadata.default
                                                |> Metadata.isQuoted
                                      , implementation =
                                            QAST.SoloImpl
                                                [ QAST.Builtin emptyRange Builtin.Plus
                                                ]
                                      }
                                    ]
                            }
                    in
                    case run input of
                        Ok _ ->
                            Expect.pass

                        Err _ ->
                            Expect.fail "Did not expect type check to fail."