Erase non-reified type parameters by-default when inlining.

Substitution of type arguments to non-reified type parameters may lead
to accidental reification, which should not be done (see ^KT-60174 for
examples). So, we should erase them, except the few cases.

^KT-60174: Fixed
^KT-60175: Fixed
This commit is contained in:
vladislav.grechko
2023-07-27 18:30:50 +02:00
committed by Space Team
parent 29ecc4d987
commit f318b5969d
89 changed files with 2369 additions and 280 deletions
@@ -1,5 +1,8 @@
// WITH_STDLIB
// See KT-65230
// IGNORE_BACKEND: JS_IR, JS_IR_ES6
fun toStringTemplateAny(x: Any) = " $x "
fun <T> toStringTemplateGeneric(x: T) = " $x "
inline fun <T> toStringTemplateInlineGeneric(x: T) = " $x "
+1 -1
View File
@@ -317,7 +317,7 @@ fun testCompareDifferentInstancesInSmartCast() {
fun testCompareDifferentInstncesInInlineTemplate() {
inline fun <reified T, reified S> myEq(x: T, y: S) = x == y
// CHECK_NEW_COUNT: function=testCompareDifferentInstncesInInlineTemplate$caseJsEq count=8
// CHECK_NEW_COUNT: function=testCompareDifferentInstncesInInlineTemplate$caseJsEq count=0
fun caseJsEq() {
assertTrue(myEq(ClassInt(1), ClassInt(1)))
assertTrue(myEq(ClassString("foo"), ClassString("foo")))
@@ -1,6 +1,10 @@
// DONT_TARGET_EXACT_BACKEND: WASM
// WASM_MUTE_REASON: UNSUPPORTED_JS_INTEROP
// EXPECTED_REACHABLE_NODES: 1412
// See KT-65230
// IGNORE_BACKEND: JS_IR, JS_IR_ES6
//FILE: nativeClassAsReifiedTypeArgument.kt
var global = ""