[Wasm] Disallow dynamic type in K2 (KT-56849)
This commit is contained in:
committed by
Space Team
parent
5cac013d8c
commit
aeeb5d5c48
+18
@@ -0,0 +1,18 @@
|
||||
/*
|
||||
* Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.fir.analysis.wasm.checkers
|
||||
|
||||
import org.jetbrains.kotlin.fir.analysis.checkers.declaration.*
|
||||
import org.jetbrains.kotlin.fir.analysis.checkers.type.FirTypeRefChecker
|
||||
import org.jetbrains.kotlin.fir.analysis.checkers.type.TypeCheckers
|
||||
import org.jetbrains.kotlin.fir.analysis.wasm.checkers.declaration.*
|
||||
|
||||
object WasmTypeCheckers : TypeCheckers() {
|
||||
override val typeRefCheckers: Set<FirTypeRefChecker>
|
||||
get() = setOf(
|
||||
FirDynamicUnsupportedChecker,
|
||||
)
|
||||
}
|
||||
@@ -15,6 +15,7 @@ import org.jetbrains.kotlin.fir.analysis.native.checkers.NativeDeclarationChecke
|
||||
import org.jetbrains.kotlin.fir.analysis.native.checkers.NativeExpressionCheckers
|
||||
import org.jetbrains.kotlin.fir.analysis.wasm.checkers.WasmDeclarationCheckers
|
||||
import org.jetbrains.kotlin.fir.analysis.wasm.checkers.WasmExpressionCheckers
|
||||
import org.jetbrains.kotlin.fir.analysis.wasm.checkers.WasmTypeCheckers
|
||||
import org.jetbrains.kotlin.fir.session.FirSessionConfigurator
|
||||
|
||||
fun FirSessionConfigurator.registerCommonCheckers() {
|
||||
@@ -50,4 +51,5 @@ fun FirSessionConfigurator.registerNativeCheckers() {
|
||||
fun FirSessionConfigurator.registerWasmCheckers() {
|
||||
useCheckers(WasmDeclarationCheckers)
|
||||
useCheckers(WasmExpressionCheckers)
|
||||
useCheckers(WasmTypeCheckers)
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
val foo: dynamic = 1
|
||||
|
||||
fun foo(x: dynamic): dynamic {
|
||||
class C {
|
||||
val foo: dynamic = 1
|
||||
}
|
||||
return x + C().foo
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
val foo: <!UNSUPPORTED!>dynamic<!> = 1
|
||||
|
||||
fun foo(x: <!UNSUPPORTED!>dynamic<!>): <!UNSUPPORTED!>dynamic<!> {
|
||||
|
||||
Reference in New Issue
Block a user