Play

Check-in [18c7d0bfa4]
Login
Overview
Comment:Require a list of external modules, so qualifier can validate external module references.
Timelines: family | ancestors | descendants | both | modules
Files: files | file ages | folders
SHA3-256: 18c7d0bfa41373615aceaba9d3bc144fdf7a6fc1e9c4ae2b6afc7e706098ce64
User & Date: robin.hansen on 2021-02-11 09:27:51
Other Links: branch diff | manifest | tags
Context
2021-02-11
11:50
On second thought, externalModules should be a module => package dict. check-in: 9a52bbbd5e user: robin.hansen tags: modules
09:27
Require a list of external modules, so qualifier can validate external module references. check-in: 18c7d0bfa4 user: robin.hansen tags: modules
2021-02-10
13:44
Can now resolve package references in multiword definitions. check-in: f4459e72ea user: robin.hansen tags: modules
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Modified src/Play/Qualifier.elm from [306edcadda] to [ab2dcebd3f].

75
76
77
78
79
80
81

82
83
84
85
86
87
88
        ]


type alias RunConfig =
    { packageName : String
    , modulePath : String
    , ast : Parser.AST

    }


run : RunConfig -> Result (List Problem) AST
run config =
    let
        ( typeErrors, qualifiedTypes ) =







>







75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
        ]


type alias RunConfig =
    { packageName : String
    , modulePath : String
    , ast : Parser.AST
    , externalModules : List String
    }


run : RunConfig -> Result (List Problem) AST
run config =
    let
        ( typeErrors, qualifiedTypes ) =

Modified tests/Test/Qualifier.elm from [7932be559f] to [abab48f2d8].

897
898
899
900
901
902
903

904
905
906
907
908
909
910
...
958
959
960
961
962
963
964

965
966
967
968
969
970
971
972
973
974
                            }

                        result =
                            run
                                { packageName = "play/test"
                                , modulePath = "package/tests"
                                , ast = unqualifiedAst

                                }
                    in
                    case result of
                        Err err ->
                            Expect.fail <| "Did not expect qualification to fail with error: " ++ Debug.toString err

                        Ok actualAst ->
................................................................................
                            }

                        result =
                            run
                                { packageName = "play/test"
                                , modulePath = "package/tests"
                                , ast = unqualifiedAst

                                }
                    in
                    case result of
                        Err err ->
                            Expect.fail <| "Did not expect qualification to fail with error: " ++ Debug.toString err

                        Ok actualAst ->
                            Expect.equal expectedAst actualAst
            ]
        ]







>







 







>










897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
...
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
                            }

                        result =
                            run
                                { packageName = "play/test"
                                , modulePath = "package/tests"
                                , ast = unqualifiedAst
                                , externalModules = []
                                }
                    in
                    case result of
                        Err err ->
                            Expect.fail <| "Did not expect qualification to fail with error: " ++ Debug.toString err

                        Ok actualAst ->
................................................................................
                            }

                        result =
                            run
                                { packageName = "play/test"
                                , modulePath = "package/tests"
                                , ast = unqualifiedAst
                                , externalModules = []
                                }
                    in
                    case result of
                        Err err ->
                            Expect.fail <| "Did not expect qualification to fail with error: " ++ Debug.toString err

                        Ok actualAst ->
                            Expect.equal expectedAst actualAst
            ]
        ]

Modified tests/Test/Qualifier/Error.elm from [e0d5fe30cb] to [b8782311a5].

149
150
151
152
153
154
155

156
157
158
159
160
161
162
163
164
165
166
167
checkForError fn source =
    let
        result =
            run
                { packageName = ""
                , modulePath = ""
                , ast = source

                }
    in
    case result of
        Err errors ->
            if List.any fn errors then
                Expect.pass

            else
                Expect.fail <| "Failed for unexpected reason: " ++ Debug.toString errors

        Ok _ ->
            Expect.fail "Did not expect parsing to succeed"







>












149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
checkForError fn source =
    let
        result =
            run
                { packageName = ""
                , modulePath = ""
                , ast = source
                , externalModules = []
                }
    in
    case result of
        Err errors ->
            if List.any fn errors then
                Expect.pass

            else
                Expect.fail <| "Failed for unexpected reason: " ++ Debug.toString errors

        Ok _ ->
            Expect.fail "Did not expect parsing to succeed"

Modified tests/Test/Qualifier/Util.elm from [0a51ee943f] to [40a2baa166].

25
26
27
28
29
30
31

32
33
34
35
36
37
38
..
46
47
48
49
50
51
52

53
54
55
56
57
58
59
expectOutput parserAst expectedAst =
    let
        result =
            AST.run
                { packageName = ""
                , modulePath = ""
                , ast = parserAst

                }
    in
    case result of
        Err errors ->
            Expect.fail <| "Did not expect qualification to fail. Errors: " ++ Debug.toString errors

        Ok actualAst ->
................................................................................
expectModuleOutput parserAst expectedAst =
    let
        result =
            AST.run
                { packageName = "play/test"
                , modulePath = "some/module"
                , ast = parserAst

                }
    in
    case result of
        Err errors ->
            Expect.fail <| "Did not expect qualification to fail. Errors: " ++ Debug.toString errors

        Ok actualAst ->







>







 







>







25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
..
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
expectOutput parserAst expectedAst =
    let
        result =
            AST.run
                { packageName = ""
                , modulePath = ""
                , ast = parserAst
                , externalModules = []
                }
    in
    case result of
        Err errors ->
            Expect.fail <| "Did not expect qualification to fail. Errors: " ++ Debug.toString errors

        Ok actualAst ->
................................................................................
expectModuleOutput parserAst expectedAst =
    let
        result =
            AST.run
                { packageName = "play/test"
                , modulePath = "some/module"
                , ast = parserAst
                , externalModules = []
                }
    in
    case result of
        Err errors ->
            Expect.fail <| "Did not expect qualification to fail. Errors: " ++ Debug.toString errors

        Ok actualAst ->