-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Bug with inner classe inheritance. #1806
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
That's no longer allowed. You have to rewrite the inner classes to have different names. Look at the inner Ops classes in subclasses of type scala.math.Numeric to see what needs to be done. |
I could not reproduce the crash. Did you paste the wrong test? (it's the same as the one before). |
Oh yes, the correct tests is trait A {
class Inner
}
trait B extends A {
class Inner2 extends super.Inner
} |
That one also works fine for me (?) |
Im getting this in the repl: scala> trait A {
class Inner
}
defined trait A
scala> trait B extends A {
class Inner2 extends super.Inner
}exception while typing [cannot display due to dotty.tools.dotc.core.Denotations$StaleSymbol: stale symbol; method line1$object$$iw$$iw$A$Inner$$$outer#32842 in class Inner, defined in Period(19..32, run = 4), is referred to in run Period(32..32, run = 6), raw string = dotty.tools.dotc.printing.Formatting$StringFormatter@18bf3d14] of class class dotty.tools.dotc.ast.Trees$Apply # 2297
exception while typing [cannot display due to dotty.tools.dotc.core.Denotations$StaleSymbol: stale symbol; method line1$object$$iw$$iw$A$Inner$$$outer#32842 in class Inner, defined in Period(19..32, run = 4), is referred to in run Period(32..32, run = 6), raw string = dotty.tools.dotc.printing.Formatting$StringFormatter@4fb64261] of class class dotty.tools.dotc.ast.Trees$TypeDef # 2318
exception while typing [cannot display due to dotty.tools.dotc.core.Denotations$StaleSymbol: stale symbol; method line1$object$$iw$$iw$A$Inner$$$outer#32842 in class Inner, defined in Period(19..32, run = 4), is referred to in run Period(32..32, run = 6), raw string = dotty.tools.dotc.printing.Formatting$StringFormatter@42607a4f] of class class dotty.tools.dotc.ast.Trees$TypeDef # 2320
exception while typing [cannot display due to dotty.tools.dotc.core.Denotations$StaleSymbol: stale symbol; method line1$object$$iw$$iw$A$Inner$$$outer#32842 in class Inner, defined in Period(19..32, run = 4), is referred to in run Period(32..32, run = 6), raw string = dotty.tools.dotc.printing.Formatting$StringFormatter@782663d3] of class class dotty.tools.dotc.ast.Trees$TypeDef # 2322
exception while typing [cannot display due to dotty.tools.dotc.core.Denotations$StaleSymbol: stale symbol; method line1$object$$iw$$iw$A$Inner$$$outer#32842 in class Inner, defined in Period(19..32, run = 4), is referred to in run Period(32..32, run = 6), raw string = dotty.tools.dotc.printing.Formatting$StringFormatter@1990a65e] of class class dotty.tools.dotc.ast.Trees$TypeDef # 2324
exception while typing [cannot display due to dotty.tools.dotc.core.Denotations$StaleSymbol: stale symbol; method line1$object$$iw$$iw$A$Inner$$$outer#32842 in class Inner, defined in Period(19..32, run = 4), is referred to in run Period(32..32, run = 6), raw string = dotty.tools.dotc.printing.Formatting$StringFormatter@64485a47] of class class dotty.tools.dotc.ast.Trees$TypeDef # 2326
exception while typing [cannot display due to dotty.tools.dotc.core.Denotations$StaleSymbol: stale symbol; method line1$object$$iw$$iw$A$Inner$$$outer#32842 in class Inner, defined in Period(19..32, run = 4), is referred to in run Period(32..32, run = 6), raw string = dotty.tools.dotc.printing.Formatting$StringFormatter@25bbf683] of class class dotty.tools.dotc.ast.Trees$PackageDef # 2327
Exception in thread "main" dotty.tools.dotc.core.Denotations$StaleSymbol: stale symbol; method line1$object$$iw$$iw$A$Inner$$$outer#32842 in class Inner, defined in Period(19..32, run = 4), is referred to in run Period(32..32, run = 6)
at dotty.tools.dotc.core.Denotations$SingleDenotation.staleSymbolError(Denotations.scala:932)
at dotty.tools.dotc.core.Denotations$SingleDenotation.bringForward(Denotations.scala:742)
at dotty.tools.dotc.core.Denotations$SingleDenotation.current(Denotations.scala:786)
at dotty.tools.dotc.core.Symbols$Symbol.denot(Symbols.scala:387)
at dotty.tools.dotc.core.Scopes$Scope.denotsNamed(Scopes.scala:119)
at dotty.tools.dotc.core.SymDenotations$ClassDenotation.membersNamed(SymDenotations.scala:1592)
at dotty.tools.dotc.core.SymDenotations$ClassDenotation.findMember(SymDenotations.scala:1645)
at dotty.tools.dotc.core.Types$Type.go$1(Types.scala:445)
at dotty.tools.dotc.core.Types$Type.findMember(Types.scala:580)
at dotty.tools.dotc.core.Types$Type.memberExcluding(Types.scala:414)
at dotty.tools.dotc.core.Types$Type$$anonfun$member$1.apply(Types.scala:398)
at dotty.tools.dotc.core.Types$Type$$anonfun$member$1.apply(Types.scala:398)
at dotty.tools.dotc.util.Stats$.track(Stats.scala:35)
|
It looks like the issue is only in the repl |
Some outer accessors were defined at phase explicitOuter, but were entered into the scope of their enclosing class only at phase explicitOuter + 1. This turned them to stale symbols when trying to access them at a later run, because at their initially valid phase they were not found as members of their owner.
Fix #1806: Define outer accessors at the right phase
The following code
fails to compile with this error:
This pattern can be found in
scala-scala/src/library/scala/collection/parallel/ParSeqLike.scala
withprotected trait Accessor[R, Tp] extends super.Accessor[R, Tp]
.Even worse, the compiler crashes when compiling
The text was updated successfully, but these errors were encountered: