-
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.
- Loading branch information
Showing
8 changed files
with
126 additions
and
91 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
This file was deleted.
Oops, something went wrong.
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,17 @@ | ||
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 x4: Int @annot((x: Int) => x) = 0 // error | ||
|
||
@annot(m1(2)) val y1: Int = 0 // error | ||
@annot(throw new Error()) val y2: Int = 0 // error | ||
@annot((x: Int) => x) val y3: Int = 0 // error | ||
@annot(x + 1) 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,27 @@ | ||
class annot[T](arg: T) extends scala.annotation.Annotation | ||
|
||
type T1 = Int @annot(42) | ||
type T2 = Int @annot("hello") | ||
type T9 = Int @annot(classOf[Int]) | ||
type T3 = Int @annot(Array(1,2)) | ||
type T4 = Int @annot(Array(Array(1,2),Array(3,4))) | ||
type T5 = Int @annot((1,2)) | ||
type T6 = Int @annot((1,2,3)) | ||
type T7 = Int @annot(((1,2),3)) | ||
type T8 = Int @annot(((1,2),(3,4))) | ||
def main = | ||
val n: Int = ??? | ||
def f(x: Any): Unit = () | ||
|
||
val x1: Int @annot(42) = 0 | ||
val x2: Int @annot("hello") = 0 | ||
val x3: Int @annot(classOf[Int]) = 0 | ||
val x4: Int @annot(Array(1,2)) = 0 | ||
val x5: Int @annot(Array(Array(1,2),Array(3,4))) = 0 | ||
val x6: Int @annot((1,2)) = 0 | ||
val x7: Int @annot((1,2,3)) = 0 | ||
val x8: Int @annot(((1,2),3)) = 0 | ||
val x9: Int @annot(((1,2),(3,4))) = 0 | ||
|
||
@annot(42) val y1: Int = 0 | ||
@annot("hello") val y2: Int = 0 | ||
@annot(classOf[Int]) val y3: Int = 0 | ||
@annot(Array(1,2)) val y4: Int = 0 | ||
@annot(Array(Array(1,2),Array(3,4))) val y5: Int = 0 | ||
@annot((1,2)) val y6: Int = 0 | ||
@annot((1,2,3)) val y7: Int = 0 | ||
@annot(((1,2),3)) val y8: Int = 0 | ||
@annot(((1,2),(3,4))) val y9: Int = 0 | ||
|
||
() |