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

Define @static def that is also available on module #19394

Closed
armanbilge opened this issue Jan 8, 2024 · 0 comments · Fixed by #19400
Closed

Define @static def that is also available on module #19394

armanbilge opened this issue Jan 8, 2024 · 0 comments · Fixed by #19400
Assignees
Milestone

Comments

@armanbilge
Copy link
Contributor

armanbilge commented Jan 8, 2024

Compiler version

3.4.0-RC1-bin-20240106-c15cc9c-NIGHTLY

Minimized code

//> using scala 3.4.0-RC1-bin-20240106-c15cc9c-NIGHTLY

import scala.annotation.static
import scala.annotation.targetName

class Foo

object Foo {
  @static def foo: Foo = ???
  @targetName("foo") def fooBincompat: Foo = foo
}

Output

[error] ./test.scala:10:26
[error] Double definition:
[error] def foo: Foo in object Foo at line 9 and
[error] def fooBincompat: Foo in object Foo at line 10
[error] have the same type (): Foo after erasure.
[error]   @targetName("foo") def fooBincompat: Foo = foo
[error]                          ^

Expectation

I'm seeking a way that we can add the @static annotation post-facto without breaking binary-compatibility. So we need some way to retain or restore the old definition on the module.

@armanbilge armanbilge added itype:bug stat:needs triage Every issue needs to have an "area" and "itype" label labels Jan 8, 2024
@dwijnand dwijnand self-assigned this Jan 8, 2024
@dwijnand dwijnand removed the stat:needs triage Every issue needs to have an "area" and "itype" label label Jan 8, 2024
@Kordyjan Kordyjan added this to the 3.4.1 milestone Feb 14, 2024
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.

3 participants