-
Notifications
You must be signed in to change notification settings - Fork 21
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
Spurious auto-application warnings with java methods with -Xsource:2.14
#11639
Comments
@Kaishh Thanks for the report. I agree with exempting |
For a potential contributor, a good place to start would be looking into the changeset in scala/scala#7660. |
See also @adriaanm's description in scala/scala#7660:
|
|
scala> case class Foo(override val toString: String)
defined class Foo
scala> typeOf[Foo].member(TermName("toString")).typeSignature
res1: $r.intp.global.Type = => String
scala> case class Bar(b: String) { override def toString: String = "" }
defined class Bar
scala> typeOf[Bar].member(TermName("toString")).typeSignature
res2: $r.intp.global.Type = ()String 🤔 |
Thanks @joroKr21
Both cases are covered by 5.1.4 on overriding, except that defs cannot eliminate a param list, by the special rule mentioned there. Did I say that correctly? It's so late here, I'm going to sleep. Probably a good spec is legible at bedtime. |
Fixes scala/bug#11639 The compiler gets confused about the lineage of `toString` apparently, so instead of trying to look for the Java flag, I am just going to see if the name exists under `AnyTpe`.
Fixes scala/bug#11639 Fixes scala/bug#11657 The compiler gets confused about the lineage of `toString` apparently, so instead of trying to look for the Java flag, I am just going to see if the name exists under `AnyTpe`.
Here's my PR for this - scala/scala#8296 |
Fixes scala/bug#11639 Fixes scala/bug#11657 The compiler gets confused about the lineage of `toString` apparently, so instead of trying to look for the Java flag, I am just going to see if the name exists under `AnyTpe`.
…under -Xsource:2.14 Fixes scala/bug#11639 Fixes scala/bug#11657 The compiler gets confused about the lineage of `toString`. This follows Dotty's `matchNullaryLoosely` implementation (https://github.com/lampepfl/dotty/blob/811dc19f418f26d6b830bb08bfb49aeee3853a49/compiler/src/dotty/tools/dotc/core/SymDenotations.scala#L950-L957), which allows `sym.owner == defn.AnyClass` and `sym == defn.Object_clone` in addition to the symbol being Java-defined.
…under -Xsource:2.14 Fixes scala/bug#11639 Fixes scala/bug#11657 The compiler gets confused about the lineage of `toString`. This follows Dotty's `matchNullaryLoosely` implementation (https://github.com/lampepfl/dotty/blob/811dc19f418f26d6b830bb08bfb49aeee3853a49/compiler/src/dotty/tools/dotc/core/SymDenotations.scala#L950-L957), which allows `sym.owner == defn.AnyClass` and `sym == defn.Object_clone` in addition to the symbol being Java-defined.
…under -Xsource:2.14 Fixes scala/bug#11639 Fixes scala/bug#11657 The compiler gets confused about the lineage of `toString`. This follows Dotty's `matchNullaryLoosely` implementation (https://github.com/lampepfl/dotty/blob/811dc19f418f26d6b830bb08bfb49aeee3853a49/compiler/src/dotty/tools/dotc/core/SymDenotations.scala#L950-L957), which allows `sym.owner == defn.AnyClass` and `sym == defn.Object_clone` in addition to the symbol being Java-defined.
With
-Xsource:2.14
my build produces warnings when calling java methods without parentheses, which is the currently recommended Scala style:However,
toString
is a Java method, which as the warning itself suggests, is excluded from deprecation!The text was updated successfully, but these errors were encountered: