-
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.
Merge pull request #13348 from dotty-staging/dep-annots
Remove anomalies and gaps in handling annotations
- Loading branch information
Showing
19 changed files
with
231 additions
and
42 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 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,7 @@ | ||
-- [E007] Type Mismatch Error: tests/neg/annot-printing.scala:5:46 ----------------------------------------------------- | ||
5 |def x: Int @nowarn @main @Foo @Bar("hello") = "abc" // error | ||
| ^^^^^ | ||
| Found: ("abc" : String) | ||
| Required: Int @nowarn() @main @Foo @Bar("hello") | ||
|
||
longer explanation available when compiling with `-explain` |
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,6 @@ | ||
import scala.annotation.* | ||
class Foo() extends Annotation | ||
class Bar(s: String) extends Annotation | ||
|
||
def x: Int @nowarn @main @Foo @Bar("hello") = "abc" // 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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
class C | ||
class ann(x: Any*) extends annotation.Annotation | ||
|
||
def f(y: C, z: C) = | ||
def g(): C @ann(y, z) = ??? | ||
val ac: ((x: C) => Array[String @ann(x)]) = ??? | ||
val dc = ac(g()) |
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,22 @@ | ||
[[syntax trees at end of typer]] // tests/printing/annot-printing.scala | ||
package <empty> { | ||
import scala.annotation.* | ||
class Foo() extends annotation.Annotation() {} | ||
class Bar(s: String) extends annotation.Annotation() { | ||
private[this] val s: String | ||
} | ||
class Xyz(i: Int) extends annotation.Annotation() { | ||
private[this] val i: Int | ||
} | ||
final lazy module val Xyz: Xyz = new Xyz() | ||
final module class Xyz() extends AnyRef() { this: Xyz.type => | ||
def $lessinit$greater$default$1: Int @uncheckedVariance = 23 | ||
} | ||
final lazy module val annot-printing$package: annot-printing$package = | ||
new annot-printing$package() | ||
final module class annot-printing$package() extends Object() { | ||
this: annot-printing$package.type => | ||
def x: Int @nowarn() @main @Xyz() @Foo @Bar("hello") = ??? | ||
} | ||
} | ||
|
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,7 @@ | ||
import scala.annotation.* | ||
|
||
class Foo() extends Annotation | ||
class Bar(s: String) extends Annotation | ||
class Xyz(i: Int = 23) extends Annotation | ||
|
||
def x: Int @nowarn @main @Xyz() @Foo @Bar("hello") = ??? |
Oops, something went wrong.