Skip to content
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

Staging code example raises compiler warning #19211

Closed
Bersier opened this issue Dec 6, 2023 · 3 comments · Fixed by #19428
Closed

Staging code example raises compiler warning #19211

Bersier opened this issue Dec 6, 2023 · 3 comments · Fixed by #19428
Labels
area:metaprogramming:quotes Issues related to quotes and splices
Milestone

Comments

@Bersier
Copy link
Contributor

Bersier commented Dec 6, 2023

Compiler version

3.3.1

Minimized example

From the Scala 3 Reference

// libraryDependencies += "org.scala-lang" %% "scala3-staging" % scalaVersion.value
import scala.quoted.staging

given staging.Compiler = staging.Compiler.make(getClass.getClassLoader)

Compiler output

Suspicious top-level unqualified call to getClass
given staging.Compiler = staging.Compiler.make(getClass.getClassLoader)

Expectation

Code examples from the Scala 3 Reference shouldn't raise compiler warnings.

@Bersier Bersier added the stat:needs triage Every issue needs to have an "area" and "itype" label label Dec 6, 2023
@nicolasstucki nicolasstucki added area:metaprogramming:quotes Issues related to quotes and splices and removed stat:needs triage Every issue needs to have an "area" and "itype" label labels Dec 6, 2023
@Bersier
Copy link
Contributor Author

Bersier commented Dec 6, 2023

Is the right fix simply to change the documentation, as suggested here?

Predef.getClass.getClassLoader

@nicolasstucki
Copy link
Contributor

Using Predef is the wrong fix.

This would work

given staging.Compiler =
  object Dummy
  staging.Compiler.make(Dummy.getClass.getClassLoader)

nicolasstucki added a commit to dotty-staging/dotty that referenced this issue Jan 12, 2024
nicolasstucki added a commit that referenced this issue Jan 18, 2024
@Kordyjan Kordyjan added this to the 3.4.1 milestone Feb 14, 2024
@Bersier
Copy link
Contributor Author

Bersier commented Feb 21, 2024

@nicolasstucki Your change to docs/_spec/TODOreference/metaprogramming/staging.md has not propagated to

Should I create pull requests to apply the change there?

WojciechMazur pushed a commit that referenced this issue Jun 27, 2024
This addresses part of #19211, #19170, and #19176

[Cherry-picked 693a80a]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:metaprogramming:quotes Issues related to quotes and splices
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants