Skip to content

Using the value O.this where O is an object does not work #324

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

Closed
smarter opened this issue Jan 6, 2015 · 0 comments
Closed

Using the value O.this where O is an object does not work #324

smarter opened this issue Jan 6, 2015 · 0 comments

Comments

@smarter
Copy link
Member

smarter commented Jan 6, 2015

object O {
   val x: this.type = O.this
}

This compiles with scalac but fails with dotty:

Exception in thread "main" java.lang.AssertionError: assertion failed: found: <noprefix>, expected: O$.type(O)
at scala.Predef$.assert(Predef.scala:165)
at dotty.tools.dotc.typer.Implicits$ImplicitSearch.<init>(Implicits.scala:455)
at dotty.tools.dotc.typer.Implicits$$anonfun$inferImplicit$1$$anonfun$apply$17.apply(Implicits.scala:432)
at dotty.tools.dotc.typer.Implicits$$anonfun$inferImplicit$1$$anonfun$apply$17.apply(Implicits.scala:428)
at dotty.tools.dotc.reporting.Reporting$class.traceIndented(Reporter.scala:143)
at dotty.tools.dotc.core.Contexts$Context.traceIndented(Contexts.scala:51)
at dotty.tools.dotc.typer.Implicits$$anonfun$inferImplicit$1.apply(Implicits.scala:428)
at dotty.tools.dotc.typer.Implicits$$anonfun$inferImplicit$1.apply(Implicits.scala:424)
at dotty.tools.dotc.util.Stats$.track(Stats.scala:35)
at dotty.tools.dotc.typer.Implicits$class.inferImplicit(Implicits.scala:424)
at dotty.tools.dotc.typer.Typer.inferImplicit(Typer.scala:58)
at dotty.tools.dotc.typer.Implicits$$anonfun$inferView$1.apply(Implicits.scala:407)
at dotty.tools.dotc.typer.Implicits$$anonfun$inferView$1.apply(Implicits.scala:401)
at dotty.tools.dotc.util.Stats$.track(Stats.scala:35)
at dotty.tools.dotc.typer.Implicits$class.inferView(Implicits.scala:400)
at dotty.tools.dotc.typer.Typer.inferView(Typer.scala:58)
at dotty.tools.dotc.typer.Typer.adaptToSubType$1(Typer.scala:1339)
at dotty.tools.dotc.typer.Typer.adaptNoArgs$1(Typer.scala:1311)
at dotty.tools.dotc.typer.Typer.adaptInterpolated(Typer.scala:1374)
at dotty.tools.dotc.typer.Typer$$anonfun$adapt$1$$anonfun$apply$14.apply(Typer.scala:1163)
at dotty.tools.dotc.typer.Typer$$anonfun$adapt$1$$anonfun$apply$14.apply(Typer.scala:1160)
at dotty.tools.dotc.reporting.Reporting$class.traceIndented(Reporter.scala:143)
at dotty.tools.dotc.core.Contexts$Context.traceIndented(Contexts.scala:51)
at dotty.tools.dotc.typer.Typer$$anonfun$adapt$1.apply(Typer.scala:1160)
at dotty.tools.dotc.typer.Typer$$anonfun$adapt$1.apply(Typer.scala:1160)
at dotty.tools.dotc.util.Stats$.track(Stats.scala:35)
at dotty.tools.dotc.typer.Typer.adapt(Typer.scala:1159)
at dotty.tools.dotc.typer.Typer$$anonfun$typed$2.apply(Typer.scala:1068)
at dotty.tools.dotc.typer.Typer$$anonfun$typed$2.apply(Typer.scala:1066)
at dotty.tools.dotc.reporting.Reporting$class.traceIndented(Reporter.scala:143)
at dotty.tools.dotc.core.Contexts$Context.traceIndented(Contexts.scala:51)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:1066)
at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:1105)
at dotty.tools.dotc.typer.Typer$$anonfun$typedValDef$1.apply(Typer.scala:860)
at dotty.tools.dotc.typer.Typer$$anonfun$typedValDef$1.apply(Typer.scala:854)
at dotty.tools.dotc.util.Stats$.track(Stats.scala:35)
at dotty.tools.dotc.typer.Typer.typedValDef(Typer.scala:854)
at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:1003)
at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:1056)
at dotty.tools.dotc.typer.Typer$$anonfun$typed$2.apply(Typer.scala:1068)
at dotty.tools.dotc.typer.Typer$$anonfun$typed$2.apply(Typer.scala:1066)
at dotty.tools.dotc.reporting.Reporting$class.traceIndented(Reporter.scala:143)
at dotty.tools.dotc.core.Contexts$Context.traceIndented(Contexts.scala:51)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:1066)
at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:1090)
at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:1101)
at dotty.tools.dotc.typer.Typer$$anonfun$typedClassDef$1.apply(Typer.scala:902)
at dotty.tools.dotc.typer.Typer$$anonfun$typedClassDef$1.apply(Typer.scala:884)
at dotty.tools.dotc.util.Stats$.track(Stats.scala:35)
at dotty.tools.dotc.typer.Typer.typedClassDef(Typer.scala:884)
at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:1009)
at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:1056)
at dotty.tools.dotc.typer.Typer$$anonfun$typed$2.apply(Typer.scala:1068)
at dotty.tools.dotc.typer.Typer$$anonfun$typed$2.apply(Typer.scala:1066)
at dotty.tools.dotc.reporting.Reporting$class.traceIndented(Reporter.scala:143)
at dotty.tools.dotc.core.Contexts$Context.traceIndented(Contexts.scala:51)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:1066)
at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:1090)
at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:1101)
at dotty.tools.dotc.typer.Typer$$anonfun$typedPackageDef$1.apply(Typer.scala:949)
at dotty.tools.dotc.typer.Typer$$anonfun$typedPackageDef$1.apply(Typer.scala:940)
at dotty.tools.dotc.util.Stats$.track(Stats.scala:35)
at dotty.tools.dotc.typer.Typer.typedPackageDef(Typer.scala:940)
at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:1046)
at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:1058)
at dotty.tools.dotc.typer.Typer$$anonfun$typed$2.apply(Typer.scala:1068)
at dotty.tools.dotc.typer.Typer$$anonfun$typed$2.apply(Typer.scala:1066)
at dotty.tools.dotc.reporting.Reporting$class.traceIndented(Reporter.scala:143)
at dotty.tools.dotc.core.Contexts$Context.traceIndented(Contexts.scala:51)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:1066)
at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:1105)
at dotty.tools.dotc.typer.FrontEnd$$anonfun$typeCheck$1.apply$mcV$sp(FrontEnd.scala:41)
at dotty.tools.dotc.typer.FrontEnd.monitor(FrontEnd.scala:18)
at dotty.tools.dotc.typer.FrontEnd.typeCheck(FrontEnd.scala:39)
at dotty.tools.dotc.typer.FrontEnd$$anonfun$runOn$3.apply(FrontEnd.scala:52)
at dotty.tools.dotc.typer.FrontEnd$$anonfun$runOn$3.apply(FrontEnd.scala:52)
at scala.collection.immutable.List.foreach(List.scala:381)
at dotty.tools.dotc.typer.FrontEnd.runOn(FrontEnd.scala:52)
at dotty.tools.dotc.Run$$anonfun$compileSources$1$$anonfun$apply$mcV$sp$3.apply(Run.scala:49)
at dotty.tools.dotc.Run$$anonfun$compileSources$1$$anonfun$apply$mcV$sp$3.apply(Run.scala:47)
at scala.collection.IndexedSeqOptimized$class.foreach(IndexedSeqOptimized.scala:33)
at scala.collection.mutable.ArrayOps$ofRef.foreach(ArrayOps.scala:186)
at dotty.tools.dotc.Run$$anonfun$compileSources$1.apply$mcV$sp(Run.scala:47)
at dotty.tools.dotc.Run$$anonfun$compileSources$1.apply(Run.scala:39)
at dotty.tools.dotc.Run$$anonfun$compileSources$1.apply(Run.scala:39)
at dotty.tools.dotc.util.Stats$.monitorHeartBeat(Stats.scala:68)
at dotty.tools.dotc.Run.compileSources(Run.scala:38)
at dotty.tools.dotc.Run.compile(Run.scala:29)
at dotty.tools.dotc.Driver.doCompile(Driver.scala:20)
at dotty.tools.dotc.Main$.doCompile(Main.scala:26)
at dotty.tools.dotc.Driver.process(Driver.scala:31)
at dotty.tools.dotc.Driver.main(Driver.scala:40)
at dotty.tools.dotc.Main.main(Main.scala)
DarkDimius added a commit to dotty-staging/dotty that referenced this issue Jan 30, 2015
That's a hack. That allows to continue to work on backend.
 Should be removed after scala#324 is fixed.
odersky added a commit that referenced this issue Jan 31, 2015
odersky added a commit to dotty-staging/dotty that referenced this issue Feb 12, 2016
An `C.this` term with erroneous class `C` will get a
`NoPrefix` type. A subsequent implicit search on this
crashed. This is fixed now.

Fixes scala#324.
smarter referenced this issue Feb 12, 2016
Better handling enclosing class computations
tgodzik added a commit to tgodzik/scala3 that referenced this issue Apr 29, 2025
Backport "feature: Skip auto importing symbols we know are wrong in current context" to 3.3 LTS
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants