-
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.
Improve when deprecation warning are emitted
- Loading branch information
1 parent
5c628d9
commit e2da4b8
Showing
3 changed files
with
48 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
-- Deprecation Warning: tests/warn/i19302.scala:8:20 ------------------------------------------------------------------- | ||
8 | def doo(): Option[Thing] = // warn | ||
| ^^^^^ | ||
| class Thing is deprecated since n/a: is deprecated | ||
-- Deprecation Warning: tests/warn/i19302.scala:9:13 ------------------------------------------------------------------- | ||
9 | Some(new Thing(1)) // warn | ||
| ^^^^^ | ||
| class Thing is deprecated since n/a: is deprecated | ||
-- Deprecation Warning: tests/warn/i19302.scala:10:23 ------------------------------------------------------------------ | ||
10 | def wop(x: => Option[Thing]) = println(x) // warn | ||
| ^^^^^ | ||
| class Thing is deprecated since n/a: is deprecated | ||
-- Deprecation Warning: tests/warn/i19302.scala:13:16 ------------------------------------------------------------------ | ||
13 | doo().map((t: Thing) => println(t)) // warn | ||
| ^^^^^ | ||
| class Thing is deprecated since n/a: is deprecated | ||
-- Deprecation Warning: tests/warn/i19302.scala:18:18 ------------------------------------------------------------------ | ||
18 | val thing = new Thing(42) // warn | ||
| ^^^^^ | ||
| class Thing is deprecated since n/a: is deprecated |
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,23 @@ | ||
//> using options -deprecation | ||
|
||
@deprecated("is deprecated", "n/a") | ||
class Thing(val value: Int) | ||
|
||
object Main extends App { | ||
|
||
def doo(): Option[Thing] = // warn | ||
Some(new Thing(1)) // warn | ||
def wop(x: => Option[Thing]) = println(x) // warn | ||
|
||
doo().map(t => println(t)) | ||
doo().map((t: Thing) => println(t)) // warn | ||
doo().map(println) | ||
doo().foreach(println) | ||
for (x <- doo()) println(x) | ||
|
||
val thing = new Thing(42) // warn | ||
println(thing) | ||
|
||
val something = Some(thing) | ||
wop(something) | ||
} |