morphir-elm icon indicating copy to clipboard operation
morphir-elm copied to clipboard

Error messages from make -f are more concise and readable than from make

Open edwardpeters opened this issue 1 year ago • 0 comments

Describe the bug Type errors coming from the incremental compiler are much more verbose and unclear than those coming from the non-incremental compiler.

To Reproduce Steps to reproduce the behavior:

Starting from following code snippet with a type error:

module Scratch.ExampleModule exposing (..)

typeErrorTest : Bool -> String
typeErrorTest x = True

Compiled with morphir-elm make -f , this produces a fairly nice error:

Error: [
  [
    "errors_in_source_file",
    "ExampleModule",
    [
      {
        "errorMessage": "Type error in value 'typeErrorTest': Could not unify 'Morphir.SDK:String:string' with 'Morphir.SDK:Basics:bool' because the references do not match",
        "sourceLocations": []
      }
    ]
  ]
]

Whereas comping with morphir-elm make, you get:

Error: [
  [
    "RepoError",
    "Cannot process value",
    [
      [
        "TypeCheckError",
        [
          [
            "example",
            "module"
          ]
        ],
        [
          "type",
          "error",
          "test"
        ],
        [
          "UnifyError",
          [
            "CouldNotUnify",
            "RefMismatch",
            [
              "meta_ref",
              [
                [
                  [
                    "morphir"
                  ],
                  [
                    "s",
                    "d",
                    "k"
                  ]
                ],
                [
                  [
                    "string"
                  ]
                ],
                [
                  "string"
                ]
              ],
              [],
              null
            ],
            [
              "meta_ref",
              [
                [
                  [
                    "morphir"
                  ],
                  [
                    "s",
                    "d",
                    "k"
                  ]
                ],
                [
                  [
                    "basics"
                  ]
                ],
                [
                  "bool"
                ]
              ],
              [],
              null
            ]
          ]
        ]
      ]
    ]
  ]
]

Expected behavior A more concise (/readable, /pretty-printed) error should be given in both instances.

Desktop (please complete the following information):

  • OS: [e.g. iOS] OSX
  • Browser: Unused
  • Version 2.89.0

edwardpeters avatar Sep 07 '23 15:09 edwardpeters