Extracted 'deparenthesizeArgument', used it where necessary
#KT-6176 Fixed
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
// !DIAGNOSTICS: -DEBUG_INFO_SMARTCAST
|
||||
|
||||
fun <R> foo(f: () -> R): R = f()
|
||||
|
||||
fun <T : Any> some(v: T?, b: T): T {
|
||||
return foo {
|
||||
if (v != null) {
|
||||
v
|
||||
}
|
||||
else {
|
||||
b
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun <T : Any> some1(v: T?, b: T): T {
|
||||
return foo { if (v != null) v else b }
|
||||
}
|
||||
|
||||
fun box() = when {
|
||||
some(1, 2) != 1 -> "fail 1"
|
||||
some(null, 2) != 2 -> "fail 2"
|
||||
some1(1, 2) != 1 -> "fail 3"
|
||||
else -> "OK"
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
DescriptorResolver@0 {
|
||||
<name not found> = JetTypeImpl@1['String']
|
||||
}
|
||||
|
||||
LazyJavaPackageFragmentProvider@2 {
|
||||
packageFragments('<root>': FqName@3) = LazyJavaPackageFragment@4['<root>']
|
||||
packageFragments('Any': FqName@5) = null
|
||||
packageFragments('R': FqName@6) = null
|
||||
packageFragments('T': FqName@7) = null
|
||||
packageFragments('java': FqName@8) = LazyJavaPackageFragment@9['java']
|
||||
packageFragments('java.lang': FqName@10) = LazyJavaPackageFragment@11['lang']
|
||||
packageFragments('java.lang.Any': FqName@12) = null
|
||||
packageFragments('java.lang.R': FqName@13) = null
|
||||
packageFragments('java.lang.T': FqName@14) = null
|
||||
packageFragments('kotlin': FqName@15) = null
|
||||
packageFragments('kotlin.Any': FqName@16) = null
|
||||
packageFragments('kotlin.R': FqName@17) = null
|
||||
packageFragments('kotlin.T': FqName@18) = null
|
||||
packageFragments('kotlin.io': FqName@19) = null
|
||||
packageFragments('kotlin.jvm': FqName@20) = null
|
||||
}
|
||||
|
||||
LazyJavaPackageFragment@4['<root>'] {
|
||||
classes('Any': Name@21) = null // through LazyPackageFragmentScopeForJavaPackage@22
|
||||
classes('equals': Name@23) = null // through LazyPackageFragmentScopeForJavaPackage@22
|
||||
classes('f': Name@24) = null // through LazyPackageFragmentScopeForJavaPackage@22
|
||||
classes('foo': Name@25) = null // through LazyPackageFragmentScopeForJavaPackage@22
|
||||
classes('invoke': Name@26) = null // through LazyPackageFragmentScopeForJavaPackage@22
|
||||
classes('some': Name@27) = null // through LazyPackageFragmentScopeForJavaPackage@22
|
||||
classes('some1': Name@28) = null // through LazyPackageFragmentScopeForJavaPackage@22
|
||||
deserializedPackageScope = Empty@29 // through LazyPackageFragmentScopeForJavaPackage@22
|
||||
functions('equals': Name@23) = EmptyList@30[empty] // through LazyPackageFragmentScopeForJavaPackage@22
|
||||
functions('f': Name@24) = EmptyList@30[empty] // through LazyPackageFragmentScopeForJavaPackage@22
|
||||
functions('foo': Name@25) = EmptyList@30[empty] // through LazyPackageFragmentScopeForJavaPackage@22
|
||||
functions('invoke': Name@26) = EmptyList@30[empty] // through LazyPackageFragmentScopeForJavaPackage@22
|
||||
functions('some': Name@27) = EmptyList@30[empty] // through LazyPackageFragmentScopeForJavaPackage@22
|
||||
functions('some1': Name@28) = EmptyList@30[empty] // through LazyPackageFragmentScopeForJavaPackage@22
|
||||
memberIndex = computeMemberIndex$1@31 // through LazyPackageFragmentScopeForJavaPackage@22
|
||||
}
|
||||
|
||||
LazyJavaPackageFragment@9['java'] {
|
||||
classes('lang': Name@32) = null // through LazyPackageFragmentScopeForJavaPackage@33
|
||||
deserializedPackageScope = Empty@29 // through LazyPackageFragmentScopeForJavaPackage@33
|
||||
functions('lang': Name@34) = EmptyList@30[empty] // through LazyPackageFragmentScopeForJavaPackage@33
|
||||
memberIndex = computeMemberIndex$1@35 // through LazyPackageFragmentScopeForJavaPackage@33
|
||||
}
|
||||
|
||||
LazyJavaPackageFragment@11['lang'] {
|
||||
classes('equals': Name@23) = null // through LazyPackageFragmentScopeForJavaPackage@36
|
||||
classes('f': Name@24) = null // through LazyPackageFragmentScopeForJavaPackage@36
|
||||
classes('foo': Name@25) = null // through LazyPackageFragmentScopeForJavaPackage@36
|
||||
classes('invoke': Name@26) = null // through LazyPackageFragmentScopeForJavaPackage@36
|
||||
classes('some': Name@27) = null // through LazyPackageFragmentScopeForJavaPackage@36
|
||||
classes('some1': Name@28) = null // through LazyPackageFragmentScopeForJavaPackage@36
|
||||
deserializedPackageScope = Empty@29 // through LazyPackageFragmentScopeForJavaPackage@36
|
||||
functions('equals': Name@23) = EmptyList@30[empty] // through LazyPackageFragmentScopeForJavaPackage@36
|
||||
functions('f': Name@24) = EmptyList@30[empty] // through LazyPackageFragmentScopeForJavaPackage@36
|
||||
functions('foo': Name@25) = EmptyList@30[empty] // through LazyPackageFragmentScopeForJavaPackage@36
|
||||
functions('invoke': Name@26) = EmptyList@30[empty] // through LazyPackageFragmentScopeForJavaPackage@36
|
||||
functions('some': Name@27) = EmptyList@30[empty] // through LazyPackageFragmentScopeForJavaPackage@36
|
||||
functions('some1': Name@28) = EmptyList@30[empty] // through LazyPackageFragmentScopeForJavaPackage@36
|
||||
memberIndex = computeMemberIndex$1@37 // through LazyPackageFragmentScopeForJavaPackage@36
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
package
|
||||
|
||||
internal fun box(): kotlin.String
|
||||
internal fun </*0*/ R> foo(/*0*/ f: () -> R): R
|
||||
internal fun </*0*/ T : kotlin.Any> some(/*0*/ v: T?, /*1*/ b: T): T
|
||||
internal fun </*0*/ T : kotlin.Any> some1(/*0*/ v: T?, /*1*/ b: T): T
|
||||
Reference in New Issue
Block a user