-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove anomalies and gaps in handling annotations #13348
Changes from 4 commits
8e06c68
00badaa
8434e57
d921598
692cbe5
046f52a
00c9adb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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` |
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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. with these changes def x: Int @<none> @<none> @<none> @<none>("hello") = "abc" There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. in 3.1.0-RC1 we still show the correct class names with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good catch! Is there an easy way to write a printing test to guard against regressions for this? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @odersky I have added tests to |
||
|
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) = ??? | ||
bishabosha marked this conversation as resolved.
Show resolved
Hide resolved
|
||
val ac: ((x: C) => Array[String @ann(x)]) = ??? | ||
val dc = ac(g()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think here we are now printing
annot
as a tree, and not a tree interpreted as an annotation