-
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.
Move checks to
class Checking
, handle boundType explicitly
- Loading branch information
Showing
5 changed files
with
159 additions
and
88 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
-- Error: tests/neg/annot-invalid.scala:7:21 --------------------------------------------------------------------------- | ||
7 | val x1: Int @annot(n + 1) = 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 | ||
| ^^^^ | ||
| 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 | ||
| ^^^^^^^^^^^^^^^^^ | ||
| 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 | ||
| ^^^^^^^^^^^^^ | ||
| Implementation restriction: not a valid annotation argument. | ||
| Argument: { | ||
| def $anonfun(x: Int): Int = x | ||
| closure($anonfun) | ||
| } | ||
| 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
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,16 @@ | ||
// `FirstTransform.toTypeTree` creates `Annotated` nodes whose `annot` are | ||
// `Ident`s, not annotation instances. This is relevant for `Checking.checkAnnot`. | ||
// | ||
// See also: | ||
// - tests/run/t2755.scala | ||
// - tests/neg/i13044.scala | ||
|
||
def f(a: Array[?]) = | ||
a match | ||
case x: Array[?] => () | ||
|
||
def f2(t: Tuple) = | ||
t match | ||
case _: (t *: ts) => () | ||
case _ => () | ||
|