Add fallback flag for legacy var smart casts after try #KT-21377 Fixed
This commit is contained in:
+1
@@ -7,6 +7,7 @@ where advanced options include:
|
||||
-Xcoroutines={enable|warn|error}
|
||||
Enable coroutines or report warnings or errors on declarations and use sites of 'suspend' modifier
|
||||
-Xintellij-plugin-root=<path> Path to the kotlin-compiler.jar or directory where IntelliJ configuration files can be found
|
||||
-Xlegacy-smart-cast-after-try Allow var smart casts despite assignment in try block
|
||||
-Xmulti-platform Enable experimental language support for multi-platform projects
|
||||
-Xnew-inference Enable new experimental generic type inference algorithm
|
||||
-Xno-check-actual Do not check presence of 'actual' modifier in multi-platform projects
|
||||
|
||||
+1
@@ -34,6 +34,7 @@ where advanced options include:
|
||||
-Xcoroutines={enable|warn|error}
|
||||
Enable coroutines or report warnings or errors on declarations and use sites of 'suspend' modifier
|
||||
-Xintellij-plugin-root=<path> Path to the kotlin-compiler.jar or directory where IntelliJ configuration files can be found
|
||||
-Xlegacy-smart-cast-after-try Allow var smart casts despite assignment in try block
|
||||
-Xmulti-platform Enable experimental language support for multi-platform projects
|
||||
-Xnew-inference Enable new experimental generic type inference algorithm
|
||||
-Xno-check-actual Do not check presence of 'actual' modifier in multi-platform projects
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
$TESTDATA_DIR$/legacySmartCastsAfterTry.kt
|
||||
-d
|
||||
$TEMP_DIR$
|
||||
-Xlegacy-smart-cast-after-try
|
||||
@@ -0,0 +1,9 @@
|
||||
fun foo() {
|
||||
var some: String? = null
|
||||
some = "alpha"
|
||||
try {
|
||||
some = "omega"
|
||||
}
|
||||
catch (e: Exception) {}
|
||||
some.length
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
compiler/testData/cli/jvm/legacySmartCastsAfterTry.kt:2:25: warning: variable 'some' initializer is redundant
|
||||
var some: String? = null
|
||||
^
|
||||
OK
|
||||
Reference in New Issue
Block a user