mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
This addresses a crash where the compiler asks if an imported class inherits initializers from its superclass /during the SIL passes/. In this particular arrangement of subclasses and initializers (see test case), this leads to us importing members of an Objective-C class for the first time well after we've destroyed the type checker, and then checking to see if an initializer added in a Swift extension can prevent initializer inheritance. That initializer hasn't been type-checked (because it's in another file and isn't supposed to affect anything), and so the compiler chokes. A spot fix would merely check for 'resolver' here and skip over the initializer if it doesn't have a type, but it's not clear what the right semantics are in that case. The real issue here is that we don't support importing new declarations after the type checker has been torn down, and that keeps causing us problems, but that's a much bigger thing to fix. https://bugs.swift.org/browse/SR-3853
22 lines
641 B
Swift
22 lines
641 B
Swift
// RUN: rm -rf %t && mkdir %t
|
|
// RUN: %target-swift-frontend -emit-module %s -DLIBRARY -I %S/Inputs/0068-sr3853/ -o %t/Lib.swiftmodule
|
|
// RUN: %target-swift-frontend -emit-sil -primary-file %s %S/Inputs/0068-sr3853/other.swift -I %S/Inputs/0068-sr3853/ -I %t -module-name main -DVALID
|
|
|
|
// Try again in an error configuration to make sure we don't crash.
|
|
// RUN: %target-swift-frontend -emit-sil -primary-file %s %S/Inputs/0068-sr3853/other.swift -I %S/Inputs/0068-sr3853/ -I %t -module-name main
|
|
|
|
// REQUIRES: objc_interop
|
|
|
|
#if LIBRARY
|
|
|
|
import BaseLib
|
|
|
|
public class GrandSub: Sub {}
|
|
|
|
#else
|
|
|
|
import Lib
|
|
|
|
func foo(object: GrandSub) { }
|
|
|
|
#endif |