forked from scala/scala3
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor NotNullInfo to record every reference which is retracted once.
- Loading branch information
Showing
4 changed files
with
100 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,62 @@ | ||
def test1: String = | ||
var x: String | Null = null | ||
x = "" | ||
var i: Int = 1 | ||
try | ||
i match | ||
case _ => | ||
x = null | ||
throw new Exception() | ||
x = "" | ||
catch | ||
case e: Exception => | ||
x.replace("", "") // error | ||
|
||
def test2: String = | ||
var x: String | Null = null | ||
x = "" | ||
var i: Int = 1 | ||
try | ||
i match | ||
case _ => | ||
x = null | ||
throw new Exception() | ||
x = "" | ||
catch | ||
case e: Exception => | ||
x = "e" | ||
x.replace("", "") // error | ||
|
||
def test3: String = | ||
var x: String | Null = null | ||
x = "" | ||
var i: Int = 1 | ||
try | ||
i match | ||
case _ => | ||
x = null | ||
throw new Exception() | ||
x = "" | ||
catch | ||
case e: Exception => | ||
finally | ||
x = "f" | ||
x.replace("", "") // ok | ||
|
||
def test4: String = | ||
var x: String | Null = null | ||
x = "" | ||
var i: Int = 1 | ||
try | ||
try | ||
if i == 1 then | ||
x = null | ||
throw new Exception() | ||
else | ||
x = "" | ||
catch | ||
case _ => | ||
x = "" | ||
catch | ||
case _ => | ||
x.replace("", "") // error |