-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Backport "Generalize warnings for top-level calls to Any or AnyRef me…
…thods" to LTS (#21091) Backports #20312 to the LTS branch. PR submitted by the release tooling. [skip ci]
- Loading branch information
Showing
5 changed files
with
48 additions
and
15 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
-- [E181] Potential Issue Warning: tests/warn/i17493.scala:4:10 -------------------------------------------------------- | ||
4 | def g = synchronized { println("hello, world") } // warn | ||
| ^^^^^^^^^^^^ | ||
| Suspicious top-level unqualified call to synchronized | ||
|--------------------------------------------------------------------------------------------------------------------- | ||
| Explanation (enabled by `-explain`) | ||
|- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
| Top-level unqualified calls to AnyRef or Any methods such as synchronized are | ||
| resolved to calls on Predef or on imported methods. This might not be what | ||
| you intended. | ||
--------------------------------------------------------------------------------------------------------------------- |
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,5 @@ | ||
//> using options -explain | ||
class A(val s: String) extends AnyVal { | ||
// def f = eq("hello, world") // no warning for now because `eq` is inlined | ||
def g = synchronized { println("hello, world") } // warn | ||
} |