Stabel

Check-in [d493a51f84]
Login
Overview
Comment:Report _first_ qualifier errors. The last ones have dodgy quality as they fail because of missing functions caused by earlier errors.
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: d493a51f84228fcdfaa49f0281cc7d6c77270891e727495f2101d34b7b9fa389
User & Date: robin.hansen on 2021-08-05 15:11:50
Other Links: manifest | tags
Context
2021-08-05
17:56
Work around known bug in elm/parser which caused line numbers to be inaccurate in the presense of li... check-in: 8e6b3144ac user: robin.hansen tags: trunk
15:11
Report _first_ qualifier errors. The last ones have dodgy quality as they fail because of missing fu... check-in: d493a51f84 user: robin.hansen tags: trunk
05:27
Write tests that expose bugs in PackageLoader. check-in: 989b747fb7 user: robin.hansen tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Modified src/Stabel/PackageLoader.elm from [3547ab065a] to [a599786d84].

35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
...
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
    | ParserError String (List (DeadEnd ParserProblem.Context ParserProblem.Problem))
    | QualifierError String (List QualifierProblem.Problem)
    | InternalError String


problemToString : Problem -> String
problemToString problem =
    let
        problemString =
            case problem of
                InvalidPackageMetadata path err ->
                    "Something is wrong with file located at '" ++ path ++ "':\n\n" ++ err

                UnknownMessageForState msg ->
                    "Unknown message for state: " ++ msg

                UnknownMessageForCompile msg ->
                    "Unknown message for compilation stage: " ++ msg

                NoExposedModulesInRootProject ->
                    "No exposed modules in root project"

                ModuleNotFound mod ->
                    "Failed to locate module '" ++ mod ++ "' on disk"

                ParserError source errs ->
                    errs
                        |> List.map (ParserProblem.toString source)
                        |> String.join "\n\n"

                QualifierError source errs ->
                    errs
                        |> List.map (QualifierProblem.toString source)
                        |> String.join "\n\n"

                InternalError msg ->
                    "Internal error: " ++ msg
    in
    problemString ++ "\n\n"


type alias InitOptions =
    { projectDirPath : String
    , stdLibPath : String
    }

................................................................................
                                    { types = Dict.union qast.types qualifiedAST.types
                                    , functions = Dict.union qast.functions qualifiedAST.functions
                                    , referenceableFunctions = Set.union qast.referenceableFunctions qualifiedAST.referenceableFunctions
                                    }
                            in
                            ( mergedQualifiedAst, es )
            in
            case errs of
                [] ->
                    Done qualifiedAst

                err :: _ ->
                    Failed err

        ( packageInfo, moduleName ) :: otherModules ->







<
<
|
|
|

|
|

|
|

|
|

|
|

|
|
|
|

|
|
|
|

|
|
<
<







 







|







35
36
37
38
39
40
41


42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69


70
71
72
73
74
75
76
...
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
    | ParserError String (List (DeadEnd ParserProblem.Context ParserProblem.Problem))
    | QualifierError String (List QualifierProblem.Problem)
    | InternalError String


problemToString : Problem -> String
problemToString problem =


    case problem of
        InvalidPackageMetadata path err ->
            "Something is wrong with file located at '" ++ path ++ "':\n\n" ++ err

        UnknownMessageForState msg ->
            "Unknown message for state: " ++ msg

        UnknownMessageForCompile msg ->
            "Unknown message for compilation stage: " ++ msg

        NoExposedModulesInRootProject ->
            "No exposed modules in root project"

        ModuleNotFound mod ->
            "Failed to locate module '" ++ mod ++ "' on disk"

        ParserError source errs ->
            errs
                |> List.map (ParserProblem.toString source)
                |> String.join "\n\n"

        QualifierError source errs ->
            errs
                |> List.map (QualifierProblem.toString source)
                |> String.join "\n\n"

        InternalError msg ->
            "Internal error: " ++ msg




type alias InitOptions =
    { projectDirPath : String
    , stdLibPath : String
    }

................................................................................
                                    { types = Dict.union qast.types qualifiedAST.types
                                    , functions = Dict.union qast.functions qualifiedAST.functions
                                    , referenceableFunctions = Set.union qast.referenceableFunctions qualifiedAST.referenceableFunctions
                                    }
                            in
                            ( mergedQualifiedAst, es )
            in
            case List.reverse errs of
                [] ->
                    Done qualifiedAst

                err :: _ ->
                    Failed err

        ( packageInfo, moduleName ) :: otherModules ->