Stdlib tests: Supporess NoInfer access instead of redeclaration

Stdlib annotation 'kotlin.internal.NoInfer' was redeclared in stdlib tests
so non-fried modules (kotlin-stdlib-jdk7, kotlin-stdlib-jdk8, etc.)
could access it.

IR deserializer does not support declaration duplicates (at least yet
for JS IR backend). Thus this commit removes this redeclaration and
suppresses errors on its usages instead.
This commit is contained in:
Svyatoslav Kuzmich
2019-04-23 23:30:07 +03:00
parent 4848911e6d
commit 5da83889d9
2 changed files with 4 additions and 14 deletions
@@ -1,11 +0,0 @@
/*
* Copyright 2010-2018 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 kotlin.internal
// to compile tests in jre/jdk/7/8 projects where stdlib internals are unavailable
@Target(AnnotationTarget.TYPE)
@Retention(AnnotationRetention.BINARY)
internal annotation class NoInfer
+4 -3
View File
@@ -5,13 +5,14 @@
package test
import kotlin.internal.NoInfer
import kotlin.test.fail
// just a static type check
fun <T> assertStaticTypeIs(@Suppress("UNUSED_PARAMETER") value: @NoInfer T) {}
@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
fun <T> assertStaticTypeIs(@Suppress("UNUSED_PARAMETER") value: @kotlin.internal.NoInfer T) {}
inline fun <reified T> assertStaticAndRuntimeTypeIs(value: @NoInfer T) {
@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
inline fun <reified T> assertStaticAndRuntimeTypeIs(value: @kotlin.internal.NoInfer T) {
@Suppress("USELESS_CAST")
if ((value as Any?) !is T) {
fail("Expected value $value to have ${T::class} type")