jakt icon indicating copy to clipboard operation
jakt copied to clipboard

typechecker: Remove redundant errors that come from bad lookups

Open cg-jl opened this issue 2 years ago • 3 comments

Removes errors of the kind "no methods available on type", "assignment between incompatible types", "attempt to access member on a non-struct type" etc. that propagate when some lookup yields "unknown" as the type of the expression. This avoids cluttering the error output and thus gives a clearer message to the user: "I got stuck at this point because I don't know what you're doing".

Failed lookups on functions now return a dummy expression that has "unknown" as the return type instead of "void". Failed lookups on method calls because of an unknown expression type id run the arguments through the typechecker but otherwise accept the call name and make it have "unknown" as a result.

Since the test proves that those redundant errors don't exist by requiring only one error to exist (the one lookup error that would've chained the redundant ones), I've modified Jakttest so it can check for this condition as well, under a exact-error flag after the Expect: .

cg-jl avatar Aug 25 '22 20:08 cg-jl

I'm in the process of preventing error propagation on a for loop as well, if this is merged I'll submit another PR.

cg-jl avatar Aug 26 '22 07:08 cg-jl

OK, now it's ready.

cg-jl avatar Aug 26 '22 10:08 cg-jl

Hello!

One or more of the commit messages in this PR do not match the Jakt code submission policy, please check the lint_commits CI job for more details on which commits were flagged and why. Please do not close this PR and open another, instead modify your commit message(s) with git commit --amend and force push those changes to update this PR.

BuggieBot avatar Aug 26 '22 10:08 BuggieBot