[K/N] Added couple of reproducers for KT-57791
This commit is contained in:
@@ -6036,6 +6036,13 @@ if (isAppleTarget(project)) {
|
||||
swiftSources = ['framework/kt56233']
|
||||
}
|
||||
|
||||
frameworkTest("testKt57791Framework") {
|
||||
framework("Kt57791") {
|
||||
sources = ['framework/kt57791']
|
||||
}
|
||||
swiftSources = ['framework/kt57791']
|
||||
}
|
||||
|
||||
frameworkTest("testPermanentObjectsFramework") {
|
||||
enabled = isExperimentalMM && !isNoopGC // Requires gc to actually happen.
|
||||
framework("PermanentObjects") {
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
interface Foo {
|
||||
fun bar(): String?
|
||||
}
|
||||
|
||||
internal class FooImplUnused : Foo {
|
||||
override fun bar(): String? = null
|
||||
}
|
||||
|
||||
fun foobar(foo: Foo): Boolean {
|
||||
val s = foo.bar()
|
||||
if (s == null)
|
||||
return false
|
||||
return s == "zzz"
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
import Foundation
|
||||
import Kt57791
|
||||
|
||||
class FooImpl : Foo {
|
||||
func bar() -> String? { "zzz" }
|
||||
}
|
||||
|
||||
func testKt57791() throws {
|
||||
try assertTrue(KnlibraryKt.foobar(foo: FooImpl()))
|
||||
}
|
||||
|
||||
class TestTests : TestProvider {
|
||||
var tests: [TestCase] = []
|
||||
|
||||
init() {
|
||||
providers.append(self)
|
||||
tests = [
|
||||
TestCase(name: "Kt57791", method: withAutorelease(testKt57791)),
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -1315,6 +1315,45 @@ __attribute__((swift_name("CKt57373")))
|
||||
@property (readonly) int32_t bar __attribute__((swift_name("bar")));
|
||||
@end
|
||||
|
||||
__attribute__((swift_name("Ckt57791")))
|
||||
@interface KtCkt57791 : KtBase
|
||||
- (instancetype)init __attribute__((swift_name("init()"))) __attribute__((objc_designated_initializer));
|
||||
+ (instancetype)new __attribute__((availability(swift, unavailable, message="use object initializers instead")));
|
||||
- (int32_t)baz __attribute__((swift_name("baz()")));
|
||||
@end
|
||||
|
||||
__attribute__((objc_subclassing_restricted))
|
||||
__attribute__((swift_name("Okt57791")))
|
||||
@interface KtOkt57791 : KtCkt57791
|
||||
+ (instancetype)alloc __attribute__((unavailable));
|
||||
+ (instancetype)allocWithZone:(struct _NSZone *)zone __attribute__((unavailable));
|
||||
- (instancetype)init __attribute__((swift_name("init()"))) __attribute__((objc_designated_initializer)) __attribute__((unavailable));
|
||||
+ (instancetype)new __attribute__((unavailable));
|
||||
+ (instancetype)okt57791 __attribute__((swift_name("init()")));
|
||||
@property (class, readonly, getter=shared) KtOkt57791 *shared __attribute__((swift_name("shared")));
|
||||
- (int32_t)baz __attribute__((swift_name("baz()")));
|
||||
@end
|
||||
|
||||
__attribute__((objc_subclassing_restricted))
|
||||
__attribute__((swift_name("Ckt57791Final")))
|
||||
@interface KtCkt57791Final : KtCkt57791
|
||||
- (instancetype)init __attribute__((swift_name("init()"))) __attribute__((objc_designated_initializer));
|
||||
+ (instancetype)new __attribute__((availability(swift, unavailable, message="use object initializers instead")));
|
||||
- (int32_t)baz __attribute__((swift_name("baz()")));
|
||||
@end
|
||||
|
||||
__attribute__((swift_name("Foo")))
|
||||
@protocol KtFoo
|
||||
@required
|
||||
- (KtCkt57791Final *)getCkt57791 __attribute__((swift_name("getCkt57791()")));
|
||||
@end
|
||||
|
||||
__attribute__((objc_subclassing_restricted))
|
||||
__attribute__((swift_name("Kt57791Kt")))
|
||||
@interface KtKt57791Kt : KtBase
|
||||
+ (BOOL)foobarF:(BOOL)f foo:(id<KtFoo>)foo __attribute__((swift_name("foobar(f:foo:)")));
|
||||
@end
|
||||
|
||||
__attribute__((objc_subclassing_restricted))
|
||||
__attribute__((swift_name("LibraryKt")))
|
||||
@interface KtLibraryKt : KtBase
|
||||
|
||||
@@ -1315,6 +1315,45 @@ __attribute__((swift_name("CKt57373")))
|
||||
@property (readonly) int32_t bar __attribute__((swift_name("bar")));
|
||||
@end
|
||||
|
||||
__attribute__((swift_name("Ckt57791")))
|
||||
@interface KtCkt57791 : KtBase
|
||||
- (instancetype)init __attribute__((swift_name("init()"))) __attribute__((objc_designated_initializer));
|
||||
+ (instancetype)new __attribute__((availability(swift, unavailable, message="use object initializers instead")));
|
||||
- (int32_t)baz __attribute__((swift_name("baz()")));
|
||||
@end
|
||||
|
||||
__attribute__((objc_subclassing_restricted))
|
||||
__attribute__((swift_name("Okt57791")))
|
||||
@interface KtOkt57791 : KtCkt57791
|
||||
+ (instancetype)alloc __attribute__((unavailable));
|
||||
+ (instancetype)allocWithZone:(struct _NSZone *)zone __attribute__((unavailable));
|
||||
- (instancetype)init __attribute__((swift_name("init()"))) __attribute__((objc_designated_initializer)) __attribute__((unavailable));
|
||||
+ (instancetype)new __attribute__((unavailable));
|
||||
+ (instancetype)okt57791 __attribute__((swift_name("init()")));
|
||||
@property (class, readonly, getter=shared) KtOkt57791 *shared __attribute__((swift_name("shared")));
|
||||
- (int32_t)baz __attribute__((swift_name("baz()")));
|
||||
@end
|
||||
|
||||
__attribute__((objc_subclassing_restricted))
|
||||
__attribute__((swift_name("Ckt57791Final")))
|
||||
@interface KtCkt57791Final : KtCkt57791
|
||||
- (instancetype)init __attribute__((swift_name("init()"))) __attribute__((objc_designated_initializer));
|
||||
+ (instancetype)new __attribute__((availability(swift, unavailable, message="use object initializers instead")));
|
||||
- (int32_t)baz __attribute__((swift_name("baz()")));
|
||||
@end
|
||||
|
||||
__attribute__((swift_name("Foo")))
|
||||
@protocol KtFoo
|
||||
@required
|
||||
- (KtCkt57791Final *)getCkt57791 __attribute__((swift_name("getCkt57791()")));
|
||||
@end
|
||||
|
||||
__attribute__((objc_subclassing_restricted))
|
||||
__attribute__((swift_name("Kt57791Kt")))
|
||||
@interface KtKt57791Kt : KtBase
|
||||
+ (BOOL)foobarF:(BOOL)f foo:(id<KtFoo>)foo __attribute__((swift_name("foobar(f:foo:)")));
|
||||
@end
|
||||
|
||||
__attribute__((objc_subclassing_restricted))
|
||||
__attribute__((swift_name("LibraryKt")))
|
||||
@interface KtLibraryKt : KtBase
|
||||
|
||||
@@ -1315,6 +1315,45 @@ __attribute__((swift_name("CKt57373")))
|
||||
@property (readonly) int32_t bar __attribute__((swift_name("bar")));
|
||||
@end
|
||||
|
||||
__attribute__((swift_name("Ckt57791")))
|
||||
@interface KtCkt57791 : KtBase
|
||||
- (instancetype)init __attribute__((swift_name("init()"))) __attribute__((objc_designated_initializer));
|
||||
+ (instancetype)new __attribute__((availability(swift, unavailable, message="use object initializers instead")));
|
||||
- (int32_t)baz __attribute__((swift_name("baz()")));
|
||||
@end
|
||||
|
||||
__attribute__((objc_subclassing_restricted))
|
||||
__attribute__((swift_name("Okt57791")))
|
||||
@interface KtOkt57791 : KtCkt57791
|
||||
+ (instancetype)alloc __attribute__((unavailable));
|
||||
+ (instancetype)allocWithZone:(struct _NSZone *)zone __attribute__((unavailable));
|
||||
- (instancetype)init __attribute__((swift_name("init()"))) __attribute__((objc_designated_initializer)) __attribute__((unavailable));
|
||||
+ (instancetype)new __attribute__((unavailable));
|
||||
+ (instancetype)okt57791 __attribute__((swift_name("init()")));
|
||||
@property (class, readonly, getter=shared) KtOkt57791 *shared __attribute__((swift_name("shared")));
|
||||
- (int32_t)baz __attribute__((swift_name("baz()")));
|
||||
@end
|
||||
|
||||
__attribute__((objc_subclassing_restricted))
|
||||
__attribute__((swift_name("Ckt57791Final")))
|
||||
@interface KtCkt57791Final : KtCkt57791
|
||||
- (instancetype)init __attribute__((swift_name("init()"))) __attribute__((objc_designated_initializer));
|
||||
+ (instancetype)new __attribute__((availability(swift, unavailable, message="use object initializers instead")));
|
||||
- (int32_t)baz __attribute__((swift_name("baz()")));
|
||||
@end
|
||||
|
||||
__attribute__((swift_name("Foo")))
|
||||
@protocol KtFoo
|
||||
@required
|
||||
- (KtCkt57791Final *)getCkt57791 __attribute__((swift_name("getCkt57791()")));
|
||||
@end
|
||||
|
||||
__attribute__((objc_subclassing_restricted))
|
||||
__attribute__((swift_name("Kt57791Kt")))
|
||||
@interface KtKt57791Kt : KtBase
|
||||
+ (BOOL)foobarF:(BOOL)f foo:(id<KtFoo>)foo __attribute__((swift_name("foobar(f:foo:)")));
|
||||
@end
|
||||
|
||||
__attribute__((objc_subclassing_restricted))
|
||||
__attribute__((swift_name("LibraryKt")))
|
||||
@interface KtLibraryKt : KtBase
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* 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 kt57791
|
||||
|
||||
abstract class Ckt57791 {
|
||||
abstract fun baz(): Int
|
||||
}
|
||||
|
||||
object Okt57791 : Ckt57791() {
|
||||
override fun baz() = 117
|
||||
}
|
||||
|
||||
class Ckt57791Final : Ckt57791() {
|
||||
override fun baz() = 42
|
||||
}
|
||||
|
||||
interface Foo {
|
||||
fun getCkt57791(): Ckt57791Final
|
||||
}
|
||||
|
||||
fun foobar(f: Boolean, foo: Foo): Boolean {
|
||||
val z = if (f) Okt57791 else foo.getCkt57791()
|
||||
return z.baz() == 42
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import Kt
|
||||
|
||||
class FooImpl : Foo {
|
||||
func getCkt57791() -> Ckt57791Final { return Ckt57791Final() }
|
||||
}
|
||||
|
||||
func testKt57791() throws {
|
||||
try assertTrue(Kt57791Kt.foobar(f: false, foo: FooImpl()))
|
||||
}
|
||||
|
||||
class Kt57791Tests : SimpleTestProvider {
|
||||
override init() {
|
||||
super.init()
|
||||
|
||||
test("testKt57791", testKt57791)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user