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
Don't skip the ValTypeCompleter in the AccessorTypeCompleter
When the AccessorTypeCompleter gets the type signature of the
ValDef, ensure that the ValTypeCompleter runs (which sets the
annotations on the field symbol) instead of just calling typeSig.
Fixesscala/bug#10471
// while `valDef` is the field definition that spawned the accessor
920
920
// NOTE: `valTypeCompleter` handles abstract vals, trait vals and lazy vals, where the ValDef carries the getter's symbol
921
921
922
-
// reuse work done in valTypeCompleter if we already computed the type signature of the val
923
-
// (assuming the field and accessor symbols are distinct -- i.e., we're not in a trait)
922
+
valDef.symbol.rawInfo match {
923
+
casec: ValTypeCompleter=>
924
+
// If the field and accessor symbols are distinct, i.e., we're not in a trait, invoke the
925
+
// valTypeCompleter. This ensures that field annotations are set correctly (scala/bug#10471).
926
+
c.completeImpl(valDef.symbol)
927
+
case _ =>
928
+
}
924
929
valvalSig=
925
-
if ((accessorSym ne valDef.symbol) && valDef.symbol.isInitialized) valDef.symbol.info
926
-
else typeSig(valDef, Nil) //don't set annotations for the valdef -- we just want to compute the type sig (TODO: dig deeper and see if we can use memberSig)
930
+
if (valDef.symbol.isInitialized) valDef.symbol.info// re-use an already computed type
931
+
else typeSig(valDef, Nil) //Don't pass any annotations to set on the valDef.symbol, just compute the type sig (TODO: dig deeper and see if we can use memberSig)
927
932
928
933
// patch up the accessor's tree if the valdef's tpt was not known back when the tree was synthesized
929
934
// can't look at `valDef.tpt` here because it may have been completed by now (this is why we pass in `missingTpt`)
0 commit comments