[FE JS] Support until operator in WRONG_OPERATION_WITH_DYNAMIC error
This commit is contained in:
committed by
teamcity
parent
0b25ce4de9
commit
2378979a99
+1
-1
@@ -4,7 +4,7 @@ fun foo() {
|
||||
val a: dynamic = Any()
|
||||
val b: dynamic = Any()
|
||||
val c = C()
|
||||
println(a<!WRONG_OPERATION_WITH_DYNAMIC!>..<!>b)
|
||||
println(a<!WRONG_OPERATION_WITH_DYNAMIC("`..` operation")!>..<!>b)
|
||||
println(c..a)
|
||||
println(a.rangeTo(b))
|
||||
}
|
||||
|
||||
Vendored
+2
@@ -0,0 +1,2 @@
|
||||
public final operator fun rangeUntil(/*0*/ p0: dynamic): dynamic
|
||||
public final fun rangeUntil(/*0*/ p0: dynamic): dynamic
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
// !LANGUAGE: +RangeUntilOperator
|
||||
|
||||
fun foo() {
|
||||
val a: dynamic = Any()
|
||||
val b: dynamic = Any()
|
||||
val c = C()
|
||||
println(a<!WRONG_OPERATION_WITH_DYNAMIC("`..<` operation")!>..<<!>b)
|
||||
println(c..<a)
|
||||
println(a.rangeUntil(b))
|
||||
}
|
||||
|
||||
class C {
|
||||
operator fun rangeUntil(other: dynamic): ClosedRange<dynamic> = TODO("not implemented")
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
package
|
||||
|
||||
public fun foo(): kotlin.Unit
|
||||
|
||||
public final class C {
|
||||
public constructor C()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public final operator fun rangeUntil(/*0*/ other: dynamic): kotlin.ranges.ClosedRange<dynamic>
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
+6
@@ -313,6 +313,12 @@ public class DiagnosticsTestWithJsStdLibGenerated extends AbstractDiagnosticsTes
|
||||
runTest("compiler/testData/diagnostics/testsWithJsStdLib/dynamicTypes/rangeExpression.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("rangeUntilExpression.kt")
|
||||
public void testRangeUntilExpression() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithJsStdLib/dynamicTypes/rangeUntilExpression.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("reified.kt")
|
||||
public void testReified() throws Exception {
|
||||
|
||||
+4
-2
@@ -19,6 +19,7 @@ package org.jetbrains.kotlin.js.resolve.diagnostics
|
||||
import com.intellij.psi.PsiElement
|
||||
import org.jetbrains.kotlin.config.LanguageFeature
|
||||
import org.jetbrains.kotlin.js.naming.NameSuggestion
|
||||
import org.jetbrains.kotlin.lexer.KtSingleValueToken
|
||||
import org.jetbrains.kotlin.lexer.KtTokens
|
||||
import org.jetbrains.kotlin.psi.*
|
||||
import org.jetbrains.kotlin.resolve.calls.checkers.CallChecker
|
||||
@@ -53,8 +54,9 @@ object JsDynamicCallChecker : CallChecker {
|
||||
in OperatorConventions.IN_OPERATIONS -> {
|
||||
reportInOperation(context, reportOn)
|
||||
}
|
||||
KtTokens.RANGE -> {
|
||||
context.trace.report(ErrorsJs.WRONG_OPERATION_WITH_DYNAMIC.on(reportOn, "`..` operation"))
|
||||
KtTokens.RANGE, KtTokens.RANGE_UNTIL -> {
|
||||
token as KtSingleValueToken
|
||||
context.trace.report(ErrorsJs.WRONG_OPERATION_WITH_DYNAMIC.on(reportOn, "`${token.value}` operation"))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user