forked from scala/scala3
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Disallow
@targetName
on top-level class
, trait
, and object
.
This usage was mostly broken, as it failed with separate compilation.
- Loading branch information
Showing
13 changed files
with
69 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import scala.annotation.targetName | ||
|
||
@targetName("B1") class A1 // error targetName on top-level class | ||
@targetName("B2") trait A2 // error targetName on top-level trait | ||
@targetName("B3") object A3 // error targetName on top-level object | ||
|
||
@targetName("bar") def foo = 42 // OK | ||
|
||
object Outer: | ||
@targetName("B1") class A1 // OK | ||
@targetName("B2") trait A2 // OK | ||
@targetName("B3") object A3 // OK | ||
@targetName("D1") class C1 // OK | ||
@targetName("D2") trait C2 // OK | ||
@targetName("D3") object C3 // OK | ||
|
||
export Outer.{A1, A2, A3} // error // error // error already defined | ||
export Outer.{C1, C2, C3} // OK |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
package alpha | ||
|
||
@scala.annotation.targetName("A") object B { | ||
def foo = 23 | ||
object Outer { | ||
@scala.annotation.targetName("A") object B { | ||
def foo = 23 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
package alpha | ||
|
||
@scala.annotation.targetName("A") class B(val i: Int = 1) | ||
object Outer: | ||
@scala.annotation.targetName("A") class B(val i: Int = 1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
object Outer: | ||
@annotation.targetName("Bar") class Foo: | ||
def it: Int = 42 | ||
|
||
export Outer.Foo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
@main def Test = | ||
assert(new Foo().it == 42) | ||
assert(Foo().it == 42) |