Skip to content

Undefined type when compiling a Dotty-compiled module that uses annotations #3625

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
jvican opened this issue Dec 2, 2017 · 3 comments
Closed
Labels
area:pickling backlog No work planned on this by the core team for the time being. itype:bug stat:needs info

Comments

@jvican
Copy link
Member

jvican commented Dec 2, 2017

I have module A with the following source file:

import scala.scalajs.reflect.annotation.EnableReflectiveInstantiation

@EnableReflectiveInstantiation
trait AbstractTestSuite {
  def properties: Properties[_]
}

Then, I have module B that uses AbstractTestSuite somehow. When compiling module B, I get the following error:

[error] undefined: new <notype> # 163215: TermRef(TypeRef(TermRef(ThisType(TypeRef(NoPrefix,module class reflect)),annotation),EnableReflectiveInstantiation),<init>)

Looks like an error of annotations + tasty?

For context, see jvican/minitest@5d37226.

@jvican jvican changed the title Undefine type when compiling a Dotty-compiled module that uses annotations Undefined type when compiling a Dotty-compiled module that uses annotations Dec 2, 2017
@OlivierBlanvillain
Copy link
Contributor

Couldn't reproduce with the following:

a.scala:

class EnableReflectiveInstantiation extends scala.annotation.Annotation

trait Properties[T]

@EnableReflectiveInstantiation
trait AbstractTestSuite {
  def properties: Properties[_]
}

b.scala:

object Test {
  val a = new AbstractTestSuite {
    def properties = new Properties[Any] {}
  }
}
$ dotc a.scala
$ dotc b.scala

@smarter
Copy link
Member

smarter commented Dec 3, 2017

I can reproduce but only if scalajs-library is missing from the classpath when compiling the second file.

A.scala:

import scala.scalajs.reflect.annotation.EnableReflectiveInstantiation

trait Properties[T]

@EnableReflectiveInstantiation
trait AbstractTestSuite {
  def properties: Properties[_]
}

B.scala:

object Test {
  val a = new AbstractTestSuite {
    def properties = new Properties[Any] {}
  }
}
% dotc -classpath "$(coursier fetch -p org.scala-js:scalajs-library_2.12:0.6.21)" A.scala
% dotc -classpath "$(coursier fetch -p org.scala-js:scalajs-library_2.12:0.6.21)":. B.scala
% dotc -classpath . B.scala
undefined: new <notype> # 74: TermRef(TypeRef(TermRef(ThisType(TypeRef(NoPrefix,module class reflect)),annotation),EnableReflectiveInstantiation),<init>)

@jvican Could you check if scalajs-library is missing from the classpath of your second module?

@ckipp01
Copy link
Member

ckipp01 commented May 11, 2023

Closing since no more information every came back on this, and it seems to also only be reproduced when it was missing on the classpath. @jvican if you ever come back to this, feel free to reopen.

@ckipp01 ckipp01 closed this as completed May 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:pickling backlog No work planned on this by the core team for the time being. itype:bug stat:needs info
Projects
None yet
Development

No branches or pull requests

5 participants