You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The typechecker uses pretty printing to show the expression where an error has occured. This means that desugared expressions are shown in the error. For example, if the class Foo does not have a constructor, trying to typecheck the expression let x = new Foo(42) in x gives the error
No method '_init' in class 'Foo'
In expression:
__tmp__._init(42)
In expression:
{__tmp__._init(42);
__tmp__}
In expression:
let __tmp__ = new Foo
in
{__tmp__._init(42);
__tmp__}
...
I see two possible solutions:
Stop printing the exact expressions and instead print the corresponding line(s) from the original source code, possibly with the erroneous expression highlighted somehow:
No constructor in class 'Foo':
let x = new Foo(42) in x
^^^^^^^^^^^
Store the sugared expressions in the desugared AST-nodes and pretty print those instead when there is an error.
No constructor in class 'Foo':
In expression:
new Foo(42)
In expression:
let x = new Foo(42) in x
Any thoughts or preferences?
The text was updated successfully, but these errors were encountered:
Second option implemented as of f26897b. The (strict) subexpressions of a desugared expression will not have a sugared representation, and will therefore not be printed in the backtrace.
Typechecking let x = new Foo(42) in x when there is no constructor in Foo gives the following error message:
No constructor in class 'Foo'
In expression:
new Foo(42)
In expression:
let x = new Foo(42)
in
x
There are some minor quirks; for example typechecking unless 42 then () gives the error
Operator 'not' is only defined for boolean types
In expression:
unless 42 then
()
The typechecker uses pretty printing to show the expression where an error has occured. This means that desugared expressions are shown in the error. For example, if the class
Foo
does not have a constructor, trying to typecheck the expressionlet x = new Foo(42) in x
gives the errorI see two possible solutions:
Any thoughts or preferences?
The text was updated successfully, but these errors were encountered: