-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow any applications in annotations
- Loading branch information
Showing
12 changed files
with
128 additions
and
139 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,54 +1,48 @@ | ||
-- Error: tests/neg/annot-invalid.scala:7:21 --------------------------------------------------------------------------- | ||
7 | val x1: Int @annot(n + 1) = 0 // error | ||
| ^^^^^ | ||
-- Error: tests/neg/annot-invalid.scala:4:21 --------------------------------------------------------------------------- | ||
4 | val x1: Int @annot(new Object {}) = 0 // error | ||
| ^^^^^^^^^^^^^ | ||
| Implementation restriction: not a valid annotation argument. | ||
| Argument: n.+(1) | ||
| Type: Int | ||
-- Error: tests/neg/annot-invalid.scala:8:22 --------------------------------------------------------------------------- | ||
8 | val x2: Int @annot(f(2)) = 0 // error | ||
| ^^^^ | ||
| Argument: { | ||
| final class $anon() extends Object() {} | ||
| new $anon():Object | ||
| } | ||
| Type: Object | ||
-- Error: tests/neg/annot-invalid.scala:5:21 --------------------------------------------------------------------------- | ||
5 | val x2: Int @annot({val x = 1}) = 0 // error | ||
| ^^^^^^^^^^^ | ||
| Implementation restriction: not a valid annotation argument. | ||
| Argument: f(2) | ||
| Type: Unit | ||
-- Error: tests/neg/annot-invalid.scala:9:21 --------------------------------------------------------------------------- | ||
9 | val x3: Int @annot(throw new Error()) = 0 // error | ||
| ^^^^^^^^^^^^^^^^^ | ||
| Argument: { | ||
| val x: Int = 1 | ||
| () | ||
| } | ||
| Type: Unit | ||
-- Error: tests/neg/annot-invalid.scala:6:21 --------------------------------------------------------------------------- | ||
6 | val x4: Int @annot((x: Int) => x) = 0 // error | ||
| ^^^^^^^^^^^^^ | ||
| Implementation restriction: not a valid annotation argument. | ||
| Argument: throw new Error() | ||
| Type: Nothing | ||
-- Error: tests/neg/annot-invalid.scala:10:21 -------------------------------------------------------------------------- | ||
10 | val x4: Int @annot((x: Int) => x) = 0 // error | ||
| ^^^^^^^^^^^^^ | ||
| Implementation restriction: not a valid annotation argument. | ||
| Argument: { | ||
| def $anonfun(x: Int): Int = x | ||
| closure($anonfun) | ||
| } | ||
| Type: Int => Int | ||
-- Error: tests/neg/annot-invalid.scala:12:9 --------------------------------------------------------------------------- | ||
12 | @annot(n + 1) val y1: Int = 0 // error | ||
| ^^^^^ | ||
| Implementation restriction: not a valid annotation argument. | ||
| Argument: n.+(1) | ||
| Type: Int | ||
-- Error: tests/neg/annot-invalid.scala:13:10 -------------------------------------------------------------------------- | ||
13 | @annot(f(2)) val y2: Int = 0 // error | ||
| ^^^^ | ||
| Implementation restriction: not a valid annotation argument. | ||
| Argument: f(2) | ||
| Type: Unit | ||
-- Error: tests/neg/annot-invalid.scala:14:9 --------------------------------------------------------------------------- | ||
14 | @annot(throw new Error()) val y3: Int = 0 // error | ||
| ^^^^^^^^^^^^^^^^^ | ||
| Implementation restriction: not a valid annotation argument. | ||
| Argument: throw new Error() | ||
| Type: Nothing | ||
-- Error: tests/neg/annot-invalid.scala:15:9 --------------------------------------------------------------------------- | ||
15 | @annot((x: Int) => x) val y4: Int = 0 // error | ||
| Argument: (x: Int) => x | ||
| Type: Int => Int | ||
-- Error: tests/neg/annot-invalid.scala:8:9 ---------------------------------------------------------------------------- | ||
8 | @annot(new Object {}) val y1: Int = 0 // error | ||
| ^^^^^^^^^^^^^ | ||
| Implementation restriction: not a valid annotation argument. | ||
| Argument: { | ||
| final class $anon() extends Object() {} | ||
| new $anon():Object | ||
| } | ||
| Type: Object | ||
-- Error: tests/neg/annot-invalid.scala:9:9 ---------------------------------------------------------------------------- | ||
9 | @annot({val x = 1}) val y2: Int = 0 // error | ||
| ^^^^^^^^^^^ | ||
| Implementation restriction: not a valid annotation argument. | ||
| Argument: { | ||
| val x: Int = 1 | ||
| () | ||
| } | ||
| Type: Unit | ||
-- Error: tests/neg/annot-invalid.scala:10:9 --------------------------------------------------------------------------- | ||
10 | @annot((x: Int) => x) val y4: Int = 0 // error | ||
| ^^^^^^^^^^^^^ | ||
| Implementation restriction: not a valid annotation argument. | ||
| Argument: { | ||
| def $anonfun(x: Int): Int = x | ||
| closure($anonfun) | ||
| } | ||
| Type: Int => Int | ||
| Argument: (x: Int) => x | ||
| Type: Int => Int |
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,17 +1,12 @@ | ||
class annot[T](arg: T) extends scala.annotation.Annotation | ||
|
||
def main = | ||
val n: Int = 0 | ||
def f(x: Any): Unit = () | ||
|
||
val x1: Int @annot(n + 1) = 0 // error | ||
val x2: Int @annot(f(2)) = 0 // error | ||
val x3: Int @annot(throw new Error()) = 0 // error | ||
val x1: Int @annot(new Object {}) = 0 // error | ||
val x2: Int @annot({val x = 1}) = 0 // error | ||
val x4: Int @annot((x: Int) => x) = 0 // error | ||
|
||
@annot(n + 1) val y1: Int = 0 // error | ||
@annot(f(2)) val y2: Int = 0 // error | ||
@annot(throw new Error()) val y3: Int = 0 // error | ||
@annot(new Object {}) val y1: Int = 0 // error | ||
@annot({val x = 1}) val y2: Int = 0 // error | ||
@annot((x: Int) => x) val y4: Int = 0 // error | ||
|
||
() |
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
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 @@ | ||
class Test { | ||
println(new t) | ||
} |
Oops, something went wrong.