Skip to content

Crash during BCode generation due to @static value access #9288

Closed
@sir-wabbit

Description

@sir-wabbit

Minimized code

// AE-de752a30942c1949a413940222cd9e573e5aa6a4
class Foo {
    import annotation.static
    class Bar
    object Bar {
        @static val x = 2
    }
    import Bar._
    x
}

Output (click arrow to expand)

-- [E129] Potential Issue Warning: test.scala:8:4 ------------------------------
8 |    x
  |    ^
  |A pure expression does nothing in statement position; you may be omitting necessary parentheses

longer explanation available when compiling with `-explain`
Error while emitting test.scala
exception occurred while compiling test.scala
java.lang.AssertionError: assertion failed: asTerm called on not-a-Term val <none> while compiling test.scala
Exception in thread "main" java.lang.AssertionError: assertion failed: asTerm called on not-a-Term val <none>
	at dotty.DottyPredef$.assertFail(DottyPredef.scala:17)
	at dotty.tools.dotc.core.Symbols$Symbol.asTerm(Symbols.scala:535)
	at dotty.tools.dotc.transform.ExplicitOuter$.dotty$tools$dotc$transform$ExplicitOuter$$$outerParamAccessor(ExplicitOuter.scala:222)
	at dotty.tools.dotc.transform.ExplicitOuter$OuterOps$.loop$1(ExplicitOuter.scala:405)
	at dotty.tools.dotc.transform.ExplicitOuter$OuterOps$.path$extension(ExplicitOuter.scala:413)
	at dotty.tools.dotc.ast.tpd$.followOuterLinks(tpd.scala:419)
	at dotty.tools.dotc.ast.tpd$.ref(tpd.scala:409)
	at dotty.tools.dotc.ast.tpd$.desugarIdentPrefix(tpd.scala:1272)
	at dotty.tools.dotc.ast.tpd$.desugarIdent(tpd.scala:1264)
	at dotty.tools.backend.jvm.DottyBackendInterface.cachedDesugarIdent(DottyBackendInterface.scala:44)
	at dotty.tools.backend.jvm.DottyBackendInterface$DesugaredSelect$.unapply(DottyBackendInterface.scala:69)
	at dotty.tools.backend.jvm.BCodeBodyBuilder$PlainBodyBuilder.genLoad(BCodeBodyBuilder.scala:369)
	at dotty.tools.backend.jvm.BCodeBodyBuilder$PlainBodyBuilder.genStat(BCodeBodyBuilder.scala:93)
	at dotty.tools.backend.jvm.BCodeBodyBuilder$PlainBodyBuilder.genBlock$$anonfun$1(BCodeBodyBuilder.scala:921)
	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.backend.jvm.BCodeBodyBuilder$PlainBodyBuilder.genBlock(BCodeBodyBuilder.scala:921)
	at dotty.tools.backend.jvm.BCodeBodyBuilder$PlainBodyBuilder.genLoad(BCodeBodyBuilder.scala:420)
	at dotty.tools.backend.jvm.BCodeSkelBuilder$PlainSkelBuilder.emitNormalMethodBody$1(BCodeSkelBuilder.scala:584)
	at dotty.tools.backend.jvm.BCodeSkelBuilder$PlainSkelBuilder.genDefDef(BCodeSkelBuilder.scala:619)
	at dotty.tools.backend.jvm.BCodeSkelBuilder$PlainSkelBuilder.gen(BCodeSkelBuilder.scala:498)
	at dotty.tools.backend.jvm.BCodeSkelBuilder$PlainSkelBuilder.gen$$anonfun$1(BCodeSkelBuilder.scala:504)
	at dotty.runtime.function.JProcedure1.apply(JProcedure1.java:15)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions