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
This is due to caching the resolution of GetType.GetTypeClass, which appears as identical Ident trees in the parent of Thing and in the RHS of e.
From the superclass context of Thing, it incorrectly cached at an outer context, where the lookup from e found it as a definition at higher precedence than the import.
A couple of notes to self or reminders:
The trees don't distinguish whether the ident is due to implicit search or import. The comment at typedIdent is false, because the elidable prefix does not result in a Select. That is, I'd expect the RHS of e to be a typed selection.
ValDef( // val e: p.GetType[p.Class]
0
"e"
<tpt> // tree.tpe=p.GetType[p.Class]
"GetType"."GetTypeClass" // implicit val GetTypeClass: p.GetType[p.Class] in object GetType, tree.tpe=p.GetType[p.Class]
)
This doesn't matter for Scala 2 -Wunused:imports because the typer records the imports it used for lookups.
Removing the loopOverPrefixes doesn't break any tests. Either that progressed elsewhere or a better test is needed. (I think I restored that code at some point last year, but I don't have commit history to see why.) (Edit: https://github.com/scala/scala3/pull/22751/files)
Compiler version
3.7.0-RC1
3.7.0-RC2
Minimized code
Compile with
-Wunused:imports
:Output
Expectation
The code does not compile without the import, the warning should not be printed.
Note
The warning goes away when you remove the line
class Thing extends Entity[Class]
.The text was updated successfully, but these errors were encountered: