Made <T> in arrayOfNulls() reified #KT-5651 Fixed

This commit is contained in:
Denis Zharkov
2014-11-13 14:34:05 +04:00
committed by Andrey Breslav
parent eec4b7094c
commit 8d47bdfebb
8 changed files with 154 additions and 4 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
package-fragment kotlin
public fun </*0*/ T> arrayOfNulls(/*0*/ size: kotlin.Int): kotlin.Array<T?>
public fun </*0*/ reified T> arrayOfNulls(/*0*/ size: kotlin.Int): kotlin.Array<T?>
public fun kotlin.Any?.equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public fun kotlin.Any?.identityEquals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public fun kotlin.String?.plus(/*0*/ other: kotlin.Any?): kotlin.String
@@ -11,7 +11,7 @@ internal final class C : kotlin.MutableIterator<kotlin.Int> {
}
package kotlin {
public fun </*0*/ T> arrayOfNulls(/*0*/ size: kotlin.Int): kotlin.Array<T?>
public fun </*0*/ reified T> arrayOfNulls(/*0*/ size: kotlin.Int): kotlin.Array<T?>
public fun kotlin.Any?.equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public fun kotlin.Any?.identityEquals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public fun kotlin.String?.plus(/*0*/ other: kotlin.Any?): kotlin.String
@@ -1,7 +1,7 @@
package
package kotlin {
public fun </*0*/ T> arrayOfNulls(/*0*/ size: kotlin.Int): kotlin.Array<T?>
public fun </*0*/ reified T> arrayOfNulls(/*0*/ size: kotlin.Int): kotlin.Array<T?>
public fun kotlin.Any?.equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public fun kotlin.Any?.identityEquals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public fun kotlin.String?.plus(/*0*/ other: kotlin.Any?): kotlin.String
@@ -0,0 +1,14 @@
// !DIAGNOSTICS: -NOTHING_TO_INLINE -UNUSED_VARIABLE
fun <T> foo() {
val x = <!TYPE_PARAMETER_AS_REIFIED!>arrayOfNulls<!><T>(5)
}
inline fun <reified T> bar() {
val x = arrayOfNulls<T>(5)
}
fun baz() {
bar<Int>()
val x: Array<Int?> = arrayOfNulls(5)
}
@@ -0,0 +1,125 @@
ClassDeserializer@0 {
classes(ClassKey@1) = DeserializedClassDescriptor@2['inline']
}
DeserializedClassDescriptor@2['inline'] {
containingDeclaration = LazyJavaPackageFragment@3['kotlin']
primaryConstructor = ConstructorDescriptorImpl@4['<init>']
}
LazyAnnotationDescriptor@5 {
resolutionResults = OverloadResolutionResultsImpl@6
type = JetTypeImpl@7['inline']
valueArguments(ValueParameterDescriptorImpl@8['strategy']) = null
}
LazyJavaPackageFragmentProvider@9 {
packageFragments('<root>': FqName@10) = LazyJavaPackageFragment@11['<root>']
packageFragments('Array': FqName@12) = null
packageFragments('Int': FqName@13) = null
packageFragments('T': FqName@14) = null
packageFragments('inline': FqName@15) = null
packageFragments('java': FqName@16) = LazyJavaPackageFragment@17['java']
packageFragments('java.lang': FqName@18) = LazyJavaPackageFragment@19['lang']
packageFragments('java.lang.Array': FqName@20) = null
packageFragments('java.lang.Int': FqName@21) = null
packageFragments('java.lang.T': FqName@22) = null
packageFragments('java.lang.inline': FqName@23) = null
packageFragments('kotlin': FqName@24) = LazyJavaPackageFragment@3['kotlin']
packageFragments('kotlin.Array': FqName@25) = null
packageFragments('kotlin.Int': FqName@26) = null
packageFragments('kotlin.T': FqName@27) = null
packageFragments('kotlin.inline': FqName@28) = null
packageFragments('kotlin.io': FqName@29) = LazyJavaPackageFragment@30['io']
packageFragments('kotlin.io.Array': FqName@31) = null
packageFragments('kotlin.io.Int': FqName@32) = null
packageFragments('kotlin.io.T': FqName@33) = null
packageFragments('kotlin.io.inline': FqName@34) = null
packageFragments('kotlin.jvm': FqName@35) = LazyJavaPackageFragment@36['jvm']
packageFragments('kotlin.jvm.Array': FqName@37) = null
packageFragments('kotlin.jvm.Int': FqName@38) = null
packageFragments('kotlin.jvm.T': FqName@39) = null
packageFragments('kotlin.jvm.inline': FqName@40) = null
}
LazyJavaPackageFragment@11['<root>'] {
classes('Array': Name@41) = null // through LazyPackageFragmentScopeForJavaPackage@42
classes('Int': Name@43) = null // through LazyPackageFragmentScopeForJavaPackage@42
classes('arrayOfNulls': Name@44) = null // through LazyPackageFragmentScopeForJavaPackage@42
classes('bar': Name@45) = null // through LazyPackageFragmentScopeForJavaPackage@42
classes('inline': Name@46) = null // through LazyPackageFragmentScopeForJavaPackage@42
deserializedPackageScope = Empty@47 // through LazyPackageFragmentScopeForJavaPackage@42
functions('arrayOfNulls': Name@44) = EmptyList@48[empty] // through LazyPackageFragmentScopeForJavaPackage@42
functions('bar': Name@45) = EmptyList@48[empty] // through LazyPackageFragmentScopeForJavaPackage@42
memberIndex = computeMemberIndex$1@49 // through LazyPackageFragmentScopeForJavaPackage@42
}
LazyJavaPackageFragment@30['io'] {
classes('Array': Name@41) = null // through LazyPackageFragmentScopeForJavaPackage@50
classes('Int': Name@43) = null // through LazyPackageFragmentScopeForJavaPackage@50
classes('arrayOfNulls': Name@44) = null // through LazyPackageFragmentScopeForJavaPackage@50
classes('bar': Name@45) = null // through LazyPackageFragmentScopeForJavaPackage@50
classes('inline': Name@46) = null // through LazyPackageFragmentScopeForJavaPackage@50
deserializedPackageScope = DeserializedPackageMemberScope@51 // through LazyPackageFragmentScopeForJavaPackage@50
functions('arrayOfNulls': Name@44) = EmptyList@48[empty] // through DeserializedPackageMemberScope@51
functions('arrayOfNulls': Name@44) = EmptyList@48[empty] // through LazyPackageFragmentScopeForJavaPackage@50
functions('bar': Name@45) = EmptyList@48[empty] // through DeserializedPackageMemberScope@51
functions('bar': Name@45) = EmptyList@48[empty] // through LazyPackageFragmentScopeForJavaPackage@50
memberIndex = computeMemberIndex$1@52 // through LazyPackageFragmentScopeForJavaPackage@50
membersProtos = HashMap@53 // through DeserializedPackageMemberScope@51
properties('arrayOfNulls': Name@44) = EmptyList@48[empty] // through DeserializedPackageMemberScope@51
properties('bar': Name@45) = EmptyList@48[empty] // through DeserializedPackageMemberScope@51
}
LazyJavaPackageFragment@17['java'] {
classes('lang': Name@54) = null // through LazyPackageFragmentScopeForJavaPackage@55
deserializedPackageScope = Empty@47 // through LazyPackageFragmentScopeForJavaPackage@55
functions('lang': Name@56) = EmptyList@48[empty] // through LazyPackageFragmentScopeForJavaPackage@55
memberIndex = computeMemberIndex$1@57 // through LazyPackageFragmentScopeForJavaPackage@55
}
LazyJavaPackageFragment@36['jvm'] {
classes('Array': Name@41) = null // through LazyPackageFragmentScopeForJavaPackage@58
classes('Int': Name@43) = null // through LazyPackageFragmentScopeForJavaPackage@58
classes('arrayOfNulls': Name@44) = null // through LazyPackageFragmentScopeForJavaPackage@58
classes('bar': Name@45) = null // through LazyPackageFragmentScopeForJavaPackage@58
classes('inline': Name@46) = null // through LazyPackageFragmentScopeForJavaPackage@58
deserializedPackageScope = Empty@47 // through LazyPackageFragmentScopeForJavaPackage@58
functions('arrayOfNulls': Name@44) = EmptyList@48[empty] // through LazyPackageFragmentScopeForJavaPackage@58
functions('bar': Name@45) = EmptyList@48[empty] // through LazyPackageFragmentScopeForJavaPackage@58
memberIndex = computeMemberIndex$1@59 // through LazyPackageFragmentScopeForJavaPackage@58
}
LazyJavaPackageFragment@3['kotlin'] {
classes('Array': Name@41) = null // through LazyPackageFragmentScopeForJavaPackage@60
classes('Int': Name@43) = null // through LazyPackageFragmentScopeForJavaPackage@60
classes('arrayOfNulls': Name@44) = null // through LazyPackageFragmentScopeForJavaPackage@60
classes('bar': Name@45) = null // through LazyPackageFragmentScopeForJavaPackage@60
classes('inline': Name@46) = DeserializedClassDescriptor@2['inline'] // through LazyPackageFragmentScopeForJavaPackage@60
classes('io': Name@61) = null // through LazyPackageFragmentScopeForJavaPackage@60
classes('jvm': Name@62) = null // through LazyPackageFragmentScopeForJavaPackage@60
deserializedPackageScope = DeserializedPackageMemberScope@63 // through LazyPackageFragmentScopeForJavaPackage@60
functions('arrayOfNulls': Name@44) = EmptyList@48[empty] // through DeserializedPackageMemberScope@63
functions('arrayOfNulls': Name@44) = EmptyList@48[empty] // through LazyPackageFragmentScopeForJavaPackage@60
functions('bar': Name@45) = EmptyList@48[empty] // through DeserializedPackageMemberScope@63
functions('bar': Name@45) = EmptyList@48[empty] // through LazyPackageFragmentScopeForJavaPackage@60
functions('io': Name@64) = EmptyList@48[empty] // through DeserializedPackageMemberScope@63
functions('io': Name@64) = EmptyList@48[empty] // through LazyPackageFragmentScopeForJavaPackage@60
functions('jvm': Name@65) = EmptyList@48[empty] // through DeserializedPackageMemberScope@63
functions('jvm': Name@65) = EmptyList@48[empty] // through LazyPackageFragmentScopeForJavaPackage@60
memberIndex = computeMemberIndex$1@66 // through LazyPackageFragmentScopeForJavaPackage@60
membersProtos = HashMap@67 // through DeserializedPackageMemberScope@63
properties('arrayOfNulls': Name@44) = EmptyList@48[empty] // through DeserializedPackageMemberScope@63
properties('bar': Name@45) = EmptyList@48[empty] // through DeserializedPackageMemberScope@63
properties('io': Name@64) = EmptyList@48[empty] // through DeserializedPackageMemberScope@63
properties('jvm': Name@65) = EmptyList@48[empty] // through DeserializedPackageMemberScope@63
}
LazyJavaPackageFragment@19['lang'] {
classes('arrayOfNulls': Name@44) = null // through LazyPackageFragmentScopeForJavaPackage@68
classes('bar': Name@45) = null // through LazyPackageFragmentScopeForJavaPackage@68
deserializedPackageScope = Empty@47 // through LazyPackageFragmentScopeForJavaPackage@68
functions('arrayOfNulls': Name@44) = EmptyList@48[empty] // through LazyPackageFragmentScopeForJavaPackage@68
functions('bar': Name@45) = EmptyList@48[empty] // through LazyPackageFragmentScopeForJavaPackage@68
memberIndex = computeMemberIndex$1@69 // through LazyPackageFragmentScopeForJavaPackage@68
}
@@ -0,0 +1,5 @@
package
kotlin.inline() internal fun </*0*/ reified T> bar(): kotlin.Unit
internal fun baz(): kotlin.Unit
internal fun </*0*/ T> foo(): kotlin.Unit
@@ -635,6 +635,12 @@ public class JetDiagnosticsTestWithStdLibGenerated extends AbstractJetDiagnostic
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/diagnostics/testsWithStdLib/reified"), Pattern.compile("^(.+)\\.kt$"), true);
}
@TestMetadata("arrayOfNullsReified.kt")
public void testArrayOfNullsReified() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/testsWithStdLib/reified/arrayOfNullsReified.kt");
doTest(fileName);
}
@TestMetadata("nonCallableReiefied.kt")
public void testNonCallableReiefied() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/testsWithStdLib/reified/nonCallableReiefied.kt");
+1 -1
View File
@@ -25,4 +25,4 @@ public fun Any?.toString(): String
public fun String?.plus(other: Any?): String
public fun arrayOfNulls<T>(size: Int): Array<T?>
public fun arrayOfNulls<reified T>(size: Int): Array<T?>