Skip to content

NoDenotation.owner #9328

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
sir-wabbit opened this issue Jul 9, 2020 · 2 comments · Fixed by #11009
Closed

NoDenotation.owner #9328

sir-wabbit opened this issue Jul 9, 2020 · 2 comments · Fixed by #11009

Comments

@sir-wabbit
Copy link

Minimized code

// AE-44b62f1449e9e3d9ed6f535c2facdcc6283703a3
object Foo {
  object Foo { }
  Foo { }
}
implicit class Foo(a: Float)
case class Foo()

Output (click arrow to expand)

-- Error: test.scala:1:0 -------------------------------------------------------
1 |object Foo {
  |^
  |Foo is already defined as object Foo in package <empty>
-- Error: test.scala:5:15 ------------------------------------------------------
5 |implicit class Foo(a: Float)
  |^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |Foo is already defined as class Foo in package <empty>
exception occurred while typechecking test.scala
exception occurred while compiling test.scala
java.lang.AssertionError: NoDenotation.owner while compiling test.scala
Exception in thread "main" java.lang.AssertionError: NoDenotation.owner
	at dotty.tools.dotc.core.SymDenotations$NoDenotation$.owner(SymDenotations.scala:2403)
	at dotty.tools.dotc.core.SymDenotations$SymDenotation.termRef(SymDenotations.scala:1460)
	at dotty.tools.dotc.typer.ImplicitRunInfo$collectParts$1$.traverse(Implicits.scala:551)
	at dotty.tools.dotc.core.Types$TypeTraverser.apply(Types.scala:5454)
	at dotty.tools.dotc.core.Types$TypeTraverser.apply(Types.scala:5454)
	at dotty.tools.dotc.typer.ProtoTypes$ViewProto.fold(ProtoTypes.scala:434)
	at dotty.tools.dotc.core.Types$TypeAccumulator.foldOver(Types.scala:5417)
	at dotty.tools.dotc.core.Types$TypeTraverser.traverseChildren(Types.scala:5455)
	at dotty.tools.dotc.typer.ImplicitRunInfo$collectParts$1$.traverse(Implicits.scala:560)
	at dotty.tools.dotc.typer.ImplicitRunInfo$collectParts$1$.apply(Implicits.scala:566)
	at dotty.tools.dotc.typer.ImplicitRunInfo.recur$1(Implicits.scala:634)
	at dotty.tools.dotc.typer.ImplicitRunInfo.computeIScope(Implicits.scala:646)
	at dotty.tools.dotc.typer.ImplicitRunInfo.implicitScope$$anonfun$1(Implicits.scala:714)
	at scala.collection.mutable.AnyRefMap.getOrElse(AnyRefMap.scala:155)
	at dotty.tools.dotc.typer.ImplicitRunInfo.implicitScope(Implicits.scala:719)
	at dotty.tools.dotc.Run.implicitScope(Run.scala:32)
	at dotty.tools.dotc.typer.Implicits$ImplicitSearch.implicitScope(Implicits.scala:1340)
	at dotty.tools.dotc.typer.Implicits$ImplicitSearch.bestImplicit(Implicits.scala:1316)
	at dotty.tools.dotc.typer.Implicits$ImplicitSearch.bestImplicit(Implicits.scala:1325)
	at dotty.tools.dotc.typer.Implicits.op$1(Implicits.scala:979)
	at dotty.tools.dotc.typer.Implicits.inferImplicit(Implicits.scala:1015)
	at dotty.tools.dotc.typer.Typer.inferImplicit(Typer.scala:89)
	at dotty.tools.dotc.typer.Implicits.inferView(Implicits.scala:763)
	at dotty.tools.dotc.typer.Typer.inferView(Typer.scala:89)
	at dotty.tools.dotc.typer.Typer.adaptToSubType$1(Typer.scala:3468)
	at dotty.tools.dotc.typer.Typer.adaptNoArgsOther$4(Typer.scala:3264)
	at dotty.tools.dotc.typer.Typer.adaptNoArgs$1(Typer.scala:3326)
	at dotty.tools.dotc.typer.Typer.adapt1(Typer.scala:3557)
	at dotty.tools.dotc.typer.Typer.op$3(Typer.scala:2881)
	at dotty.tools.dotc.typer.Typer.adapt(Typer.scala:2882)
	at dotty.tools.dotc.typer.Typer.op$1(Typer.scala:2544)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2553)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2556)
	at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:2670)
	at dotty.tools.dotc.typer.Typer.typeSelectOnTerm$1(Typer.scala:555)
	at dotty.tools.dotc.typer.Typer.typedSelect(Typer.scala:579)
	at dotty.tools.dotc.typer.Typer.tryApply$1(Typer.scala:2791)
	at dotty.tools.dotc.typer.Typer.tryInsertApplyOrImplicit$$anonfun$2(Typer.scala:2813)
	at dotty.tools.dotc.typer.Typer.tryEither(Typer.scala:2678)
	at dotty.tools.dotc.typer.Typer.tryInsertApplyOrImplicit(Typer.scala:2822)
	at dotty.tools.dotc.typer.Typer.adaptToArgs$1(Typer.scala:3008)
	at dotty.tools.dotc.typer.Typer.adapt1(Typer.scala:3549)
	at dotty.tools.dotc.typer.Typer.op$3(Typer.scala:2881)
	at dotty.tools.dotc.typer.Typer.adapt(Typer.scala:2882)
	at dotty.tools.dotc.typer.Typer.op$1(Typer.scala:2544)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2553)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2556)
	at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:2670)
	at dotty.tools.dotc.typer.Applications.typedFunPart$$anonfun$1(Applications.scala:843)
	at dotty.tools.dotc.typer.Typer.tryEither(Typer.scala:2678)
	at dotty.tools.dotc.typer.Applications.typedFunPart(Applications.scala:852)
	at dotty.tools.dotc.typer.Typer.typedFunPart(Typer.scala:89)
	at dotty.tools.dotc.typer.Applications.realApply$1(Applications.scala:864)
	at dotty.tools.dotc.typer.Applications.typedApply(Applications.scala:999)
	at dotty.tools.dotc.typer.Typer.typedApply(Typer.scala:89)
	at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2418)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2478)
	at dotty.tools.dotc.typer.Typer.op$1(Typer.scala:2544)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2553)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2556)
	at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:2604)
	at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:2626)
	at dotty.tools.dotc.typer.Typer.typedClassDef(Typer.scala:2076)
	at dotty.tools.dotc.typer.Typer.typedTypeOrClassDef$2(Typer.scala:2406)
	at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:2410)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2477)
	at dotty.tools.dotc.typer.Typer.op$1(Typer.scala:2544)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2553)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2556)
	at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:2578)
	at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:2626)
	at dotty.tools.dotc.typer.Typer.typedClassDef(Typer.scala:2076)
	at dotty.tools.dotc.typer.Typer.typedTypeOrClassDef$2(Typer.scala:2406)
	at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:2410)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2477)
	at dotty.tools.dotc.typer.Typer.op$1(Typer.scala:2544)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2553)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2556)
	at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:2578)
	at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:2626)
	at dotty.tools.dotc.typer.Typer.typedPackageDef(Typer.scala:2202)
	at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2450)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2478)
	at dotty.tools.dotc.typer.Typer.op$1(Typer.scala:2544)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2553)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2556)
	at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:2670)
	at dotty.tools.dotc.typer.FrontEnd.liftedTree1$1(FrontEnd.scala:79)
	at dotty.tools.dotc.typer.FrontEnd.typeCheck$$anonfun$1(FrontEnd.scala:84)
	at dotty.runtime.function.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)
	at dotty.tools.dotc.typer.FrontEnd.monitor(FrontEnd.scala:42)
	at dotty.tools.dotc.typer.FrontEnd.typeCheck(FrontEnd.scala:85)
	at dotty.tools.dotc.typer.FrontEnd.runOn$$anonfun$3(FrontEnd.scala:114)
	at dotty.runtime.function.JProcedure1.apply(JProcedure1.java:15)
	at dotty.runtime.function.JProcedure1.apply(JProcedure1.java:10)
	at scala.collection.immutable.List.foreach(List.scala:333)
	at dotty.tools.dotc.typer.FrontEnd.runOn(FrontEnd.scala:114)
	at dotty.tools.dotc.Run.runPhases$4$$anonfun$4(Run.scala:180)
	at dotty.runtime.function.JProcedure1.apply(JProcedure1.java:15)
	at dotty.runtime.function.JProcedure1.apply(JProcedure1.java:10)
	at scala.collection.ArrayOps$.foreach$extension(ArrayOps.scala:1323)
	at dotty.tools.dotc.Run.runPhases$5(Run.scala:190)
	at dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:198)
	at dotty.runtime.function.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)
	at dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:64)
	at dotty.tools.dotc.Run.compileUnits(Run.scala:205)
	at dotty.tools.dotc.Run.compileSources(Run.scala:142)
	at dotty.tools.dotc.Run.compile(Run.scala:124)
	at dotty.tools.dotc.Driver.doCompile(Driver.scala:38)
	at dotty.tools.dotc.Driver.process(Driver.scala:194)
	at dotty.tools.dotc.Driver.process(Driver.scala:163)
	at dotty.tools.dotc.Driver.process(Driver.scala:175)
	at dotty.tools.dotc.Driver.main(Driver.scala:202)
	at dotty.tools.dotc.Main.main(Main.scala)
@sir-wabbit
Copy link
Author

And another far more obscure example (I could not minimize it further, ridiculous!):

case class Bar(
} { ;
object Bar {
  class Foo(a: Int) extends AnyVal
  Foo()
}
type Bar

@soronpo
Copy link
Contributor

soronpo commented Aug 12, 2020

Here is a very short example that leads to a NoDenotation.owner assertion:

type Id[T] = T match {
  case _ => T
}

class Foo[T <: Id[T]]

odersky added a commit to dotty-staging/dotty that referenced this issue Jan 6, 2021
odersky added a commit to dotty-staging/dotty that referenced this issue Jan 6, 2021
@Kordyjan Kordyjan added this to the 3.0.0 milestone Aug 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants