dynamic is not a keyword on the left-hand side of callable references
This commit is contained in:
@@ -0,0 +1,12 @@
|
|||||||
|
// !DIAGNOSTICS: -REFLECTION_TYPES_NOT_LOADED -UNUSED_EXPRESSION
|
||||||
|
|
||||||
|
// MODULE[js]: m1
|
||||||
|
// FILE: k.kt
|
||||||
|
|
||||||
|
fun test() {
|
||||||
|
dynamic::foo
|
||||||
|
}
|
||||||
|
|
||||||
|
class dynamic {
|
||||||
|
fun foo() {}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
package
|
||||||
|
|
||||||
|
internal fun test(): kotlin.Unit
|
||||||
|
|
||||||
|
internal final class dynamic {
|
||||||
|
public constructor dynamic()
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
internal final fun foo(): kotlin.Unit
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
dynamic class dynamic<dynamic>(dynamic: dynamic) : dynamic {
|
dynamic class dynamic<dynamic>(dynamic: dynamic) : dynamic {
|
||||||
[dynamic] fun dynamic() {
|
[dynamic] fun dynamic() {
|
||||||
val dynamic = 1
|
val dynamic = 1
|
||||||
|
dynamic::foo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -71,6 +71,15 @@ JetFile: DynamicSoftKeyword.kt
|
|||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
INTEGER_CONSTANT
|
INTEGER_CONSTANT
|
||||||
PsiElement(INTEGER_LITERAL)('1')
|
PsiElement(INTEGER_LITERAL)('1')
|
||||||
|
PsiWhiteSpace('\n ')
|
||||||
|
CALLABLE_REFERENCE_EXPRESSION
|
||||||
|
TYPE_REFERENCE
|
||||||
|
USER_TYPE
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('dynamic')
|
||||||
|
PsiElement(COLONCOLON)('::')
|
||||||
|
REFERENCE_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('foo')
|
||||||
PsiWhiteSpace('\n ')
|
PsiWhiteSpace('\n ')
|
||||||
PsiElement(RBRACE)('}')
|
PsiElement(RBRACE)('}')
|
||||||
PsiWhiteSpace('\n')
|
PsiWhiteSpace('\n')
|
||||||
|
|||||||
@@ -3728,6 +3728,12 @@ public class JetDiagnosticsTestGenerated extends AbstractJetDiagnosticsTest {
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("callableReferences.kt")
|
||||||
|
public void testCallableReferences() throws Exception {
|
||||||
|
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/dynamicTypes/callableReferences.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("dynamicCalls.kt")
|
@TestMetadata("dynamicCalls.kt")
|
||||||
public void testDynamicCalls() throws Exception {
|
public void testDynamicCalls() throws Exception {
|
||||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/dynamicTypes/dynamicCalls.kt");
|
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/dynamicTypes/dynamicCalls.kt");
|
||||||
|
|||||||
@@ -46,6 +46,7 @@ type
|
|||||||
"dynamic" is a *soft keyword*:
|
"dynamic" is a *soft keyword*:
|
||||||
- if it occurs in a non-type context, it's an identifier
|
- if it occurs in a non-type context, it's an identifier
|
||||||
- in a type context, when followed by a dot (except for a dot that separates a receiver type from a function/property name) or an angle bracket `<`, it's an identifier
|
- in a type context, when followed by a dot (except for a dot that separates a receiver type from a function/property name) or an angle bracket `<`, it's an identifier
|
||||||
|
- on the left-hand-side of `::` in a callable reference: `dynamic::foo` implies that `dynamic` there is a normal identifier
|
||||||
|
|
||||||
## Representation
|
## Representation
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user