Files
swift-mirror/validation-test/compiler_crashers_2_fixed/0068-sr3853.swift
Jordan Rose 898940c2dd Extensions of imported classes never provide overriding initializers. (#7284)
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
2017-02-06 16:26:13 -08:00

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