Closed flofriday closed 1 year ago
Yes, we would have to catch errors in the assignment and need to store r with an error type or something and every time we use r we check if it is of the error type and throw an error type exception which does not get printed to the user. I think that's the way how swift handles this (you can try it yourself by assigning something wrong to an variable and then inspect its type in the ide. It will say <<error type>>
.
I think it wouldn't be too hard to implement, since it does only require changes in the assignment of identifier and in the typecker visit of an identifier.
Yeah sounds good.
So I am currently trying to solve this but it is not tottally easy to figure out where and why the parser gets confused.
The typechecker now has internal errortype which it assigns to experssions it cannot reason about.
If such an experssion is assigned to an variable it will also get an error type. At this point further usage of this variable will get an free pass and will not get typechecked again.
Therefore only the original sinn will be highlighted and not errors that also originate from the original mistake.
This makes the reported errors of much higher quality.
Often only the first error from the typechecker is relevant as the typechecker gets confused and prints errors that only arise from the first one.
I don't know how to handle that best, cause we probably would need to introduce a new intermediate type called Undetermined or Confused so that the parser ignores all expressions where one type is undertermined.