Don't abort on glb/lub of TypeVar#6338
Conversation
|
/sync |
b3632e2 to
e750fa8
Compare
adriaanm
left a comment
There was a problem hiding this comment.
Let's check performance.
| } else { | ||
| if (depth.isAnyDepth) lub(tvar.constr.loBounds) else lub(tvar.constr.loBounds, depth) | ||
| } | ||
| } catch { case unsolvable: NoCommonType => |
There was a problem hiding this comment.
Hmm, I'm concerned about the performance impact. Can/should we handle this by returning an error result? /cc @retronym
|
Clearly the abort is wrong, but how about just ignoring this case? I'd be more comfortable turning the abort into a debuglog. Let's not introduce exception handling here. Btw, smaller test case: |
|
I hope you won't mind if I push -f to your branch to implement my suggestion. (Original sha: 5326029) |
5326029 to
f6e3a7e
Compare
Fixes scala/bug#10514 by turning the crash into an error message.
f6e3a7e to
ac9c807
Compare
|
thank you Georgi! |
|
@adriaanm Thank you for amending my old PRs (or should I say sins). I haven't had much time lately. For some reason I thought that if we actually try to glb/lub of TypeVar the Universe would implode. |
|
No worries, sorry for taking so long. It's intense stuff :-) We actually still won't lub/glb the TypeVars -- they're now stripped by |
Instead throw a
NoCommonTypeexception and catch it when solvingtype variables to avoid a compiler crash when type inference
cannot satisfy all constraints.
Fixes scala/bug#10514 by turning the crash into an error message.
scala/bug#10519 and scala/bug#5559 also produce error messages,
but are not fixed IMO, because it looks like they should compile.