Skip to content

NoDenotation.owner using string interpolation with -Yexplicit-nulls #10539

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
abdolence opened this issue Nov 28, 2020 · 6 comments
Closed

NoDenotation.owner using string interpolation with -Yexplicit-nulls #10539

abdolence opened this issue Nov 28, 2020 · 6 comments
Assignees

Comments

@abdolence
Copy link

abdolence commented Nov 28, 2020

Minimized code

object Test:
  def foo(x: Int): String = s"$x"

-Yexplicit-nulls must be enabled in scalacOptions.

Output

[info] compiling 1 Scala source to /home/abdulla/projects/tmp/test-scala3/target/scala-3.0.0-M2/classes ...
Error while emitting Main.scala
[info] exception occurred while compiling /home/abdulla/projects/tmp/test-scala3/src/main/scala/Main.scala
java.lang.AssertionError: NoDenotation.owner while compiling /home/abdulla/projects/tmp/test-scala3/src/main/scala/Main.scala
[error] ## Exception when compiling 1 sources to /home/abdulla/projects/tmp/test-scala3/target/scala-3.0.0-M2/classes
[error] java.lang.AssertionError: NoDenotation.owner
[error] dotty.tools.dotc.core.SymDenotations$NoDenotation$.owner(SymDenotations.scala:2351)
[error] dotty.tools.backend.jvm.BCodeBodyBuilder$PlainBodyBuilder.genCallMethod(BCodeBodyBuilder.scala:1110)
[error] dotty.tools.backend.jvm.BCodeBodyBuilder$PlainBodyBuilder.genStringConcat(BCodeBodyBuilder.scala:1082)
[error] dotty.tools.backend.jvm.BCodeBodyBuilder$PlainBodyBuilder.genPrimitiveOp(BCodeBodyBuilder.scala:240)
[error] dotty.tools.backend.jvm.BCodeBodyBuilder$PlainBodyBuilder.genApply(BCodeBodyBuilder.scala:758)
[error] dotty.tools.backend.jvm.BCodeBodyBuilder$PlainBodyBuilder.genLoad(BCodeBodyBuilder.scala:356)
[error] dotty.tools.backend.jvm.BCodeSkelBuilder$PlainSkelBuilder.emitNormalMethodBody$1(BCodeSkelBuilder.scala:708)
[error] dotty.tools.backend.jvm.BCodeSkelBuilder$PlainSkelBuilder.genDefDef(BCodeSkelBuilder.scala:743)
[error] dotty.tools.backend.jvm.BCodeSkelBuilder$PlainSkelBuilder.gen(BCodeSkelBuilder.scala:591)
[error] dotty.tools.backend.jvm.BCodeSkelBuilder$PlainSkelBuilder.gen$$anonfun$1(BCodeSkelBuilder.scala:597)
[error] dotty.runtime.function.JProcedure1.apply(JProcedure1.java:15)

Expectation

Compiled successfully.

Notes

if you change s"$uid" to something like toString() or even to s"uid-${uid]" it starts working also.

@griggt
Copy link
Contributor

griggt commented Nov 28, 2020

The example compiles successfully for me using 3.0.0-M2, 3.0.0-M1, and 3.0.0-RC1-bin-20201127-ed93a48-NIGHTLY.

Are you able to reproduce the error with the code as posted?

@abdolence
Copy link
Author

abdolence commented Nov 28, 2020

Try this:
https://github.com/abdolence/scala3-opaque-type-bug

Maybe it is also related to compiler flags or sbt version, not sure.

@griggt
Copy link
Contributor

griggt commented Nov 28, 2020

I can reproduce the error when using -Yexplicit-nulls. Thanks!

@griggt griggt changed the title NoDenotation.owner for opaque types with string interpolation in apply NoDenotation.owner for opaque types with string interpolation in apply when using -Yexplicit-nulls Nov 28, 2020
@griggt
Copy link
Contributor

griggt commented Nov 28, 2020

We can actually minimize this some more to remove the use of opaque types:

object Test:
  def foo(x: Int): String = s"$x"

When compiled using -Yexplicit-nulls it fails with the same NoDenotation.owner error as above.

@griggt griggt changed the title NoDenotation.owner for opaque types with string interpolation in apply when using -Yexplicit-nulls NoDenotation.owner using string interpolation with -Yexplicit-nulls Nov 28, 2020
@abdolence
Copy link
Author

thanks @griggt
Updated the issue with your code

@noti0na1
Copy link
Member

This has been fixed in #9884.

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

3 participants