-
Notifications
You must be signed in to change notification settings - Fork 1.1k
TypedTreeCopier makes incorrect assumption when deciding if Block or If nodes need to be retyped #444
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@smarter, in future, can you please put value-classes-related tests into separate folder? Like the one for tailrec |
Sure. |
… be recomputed.
@smarter see PR |
@felixmulder Any reason this was closed? The PR was not applied, though I don't remember why we decided to not merge it at the time |
I'm not sure why this was closed - maybe I thought the fix was merged (or maybe tool magic). Could we get a comment on why the fix wasn't merged @DarkDimius ? |
Where did they disappear to?
Where did they disappear to?
Where did they disappear to?
A @smarter Can you check whether this is still an issue? |
… be recomputed.
Fix #444: be more conservative on when Block and If types should be recomputed
For blocks, from
tpd.scala
:This assumes that
tree.tpe
andtree.expr.tpe
are in sync, but with a block like:Then
tree.expr.tpe
will be aTermRef
buttree.tpe
will be a widened version of that type since theTermRef
should not escape the scope of the block. This means that if the info ofy
is changed byDenotTransformer#transform
:tree.expr.tpe
will still be a TermReftree.expr.tpe.widen
will be changedtree.tpe
will not be changed, is now incorrect, and needs to be retyped.This happens in phase
ElimErasedValueType
in my implementation of value classes, see https://github.com/smarter/dotty/tree/add/value-classes%2Bcpy-bug and reproduce the bug by running:And note that the errors disappear if you always retype
Block
andIf
: https://github.com/smarter/dotty/tree/add/value-classes%2Bcpy-bug%2BretypeAssigned to @DarkDimius .
The text was updated successfully, but these errors were encountered: