Files
swift-mirror/validation-test/compiler_crashers_2_fixed/0177-rdar-33093935.swift
Slava Pestov 2f33356083 AST: Optimize construction of the AnyObject dispatch table
Instead of visiting all members of all types and extensions, bail out
early if the type is not a class or protocol, or the extension is not
extending a class. This means we don't visit structs, enums or
protocol extensions at all, which will avoid delayed parsing.

Also, we were evaluating isObjC() on each member, which is an expensive
operation; if the member does not have an explicit @objc we would still
have to check if it overrides an @objc method or witnesses an @objc
protocol requirement.

Since most members are not ever found by dynamic lookup, this is wasted
work. Instead, let's rely on AnyObject lookup filtering non-@objc
members at the call site, which it was already doing anyway.
2019-08-12 17:55:44 -04:00

15 lines
352 B
Swift

// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -typecheck -primary-file %s %S/Inputs/0177-rdar-33093935-other.swift -verify
// REQUIRES: objc_interop
import Foundation
extension A {
static func superclass() -> AnyObject? { return nil }
@objc var name: String { return "hi" }
}
class B: A {
@objc var foo = superclass()?.name
}