mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
AST: Trigger IsDynamicRequest when retrieving semantic attributes.
This commit is contained in:
@@ -2076,6 +2076,7 @@ DeclAttributes SemanticDeclAttrsRequest::evaluate(Evaluator &evaluator,
|
||||
|
||||
// Trigger requests that cause additional semantic attributes to be added.
|
||||
if (auto vd = dyn_cast<ValueDecl>(decl)) {
|
||||
(void)vd->isDynamic();
|
||||
(void)vd->isFinal();
|
||||
}
|
||||
if (auto afd = dyn_cast<AbstractFunctionDecl>(decl)) {
|
||||
|
||||
@@ -131,6 +131,7 @@ public struct PublicStruct {
|
||||
@_transparent public var publicTransparentProperty: Int {
|
||||
get { return 1 }
|
||||
}
|
||||
public dynamic var publicDynamicProperty: Int = 5
|
||||
|
||||
public init(x: Int) {
|
||||
self.publicProperty = 1
|
||||
|
||||
@@ -40,12 +40,18 @@ func testPublicStructs() {
|
||||
let _: Double = s.publicWrappedProperty
|
||||
let _: Double = s.$publicWrappedProperty.wrappedValue
|
||||
let _: Int = s.publicTransparentProperty
|
||||
let _: Int = s.publicDynamicProperty
|
||||
PublicStruct.publicStaticMethod()
|
||||
PublicStruct.activeMethod()
|
||||
|
||||
let _ = FrozenPublicStruct(1)
|
||||
}
|
||||
|
||||
extension PublicStruct {
|
||||
@_dynamicReplacement(for: publicDynamicProperty)
|
||||
var replacementVar: Int
|
||||
}
|
||||
|
||||
func testPublicClasses() {
|
||||
let c = PublicClass(x: 2)
|
||||
let _: Int = c.publicMethod()
|
||||
|
||||
25
test/ModuleInterface/lazy-typecheck-objc.swift
Normal file
25
test/ModuleInterface/lazy-typecheck-objc.swift
Normal file
@@ -0,0 +1,25 @@
|
||||
// RUN: %empty-directory(%t)
|
||||
// RUN: %empty-directory(%t/baseline)
|
||||
// RUN: %empty-directory(%t/lazy)
|
||||
|
||||
// RUN: %target-swift-emit-module-interface(%t/baseline/Test.swiftinterface) -module-name Test %s -disable-objc-attr-requires-foundation-module
|
||||
// RUN: %target-swift-typecheck-module-from-interface(%t/baseline/Test.swiftinterface) -module-name Test
|
||||
|
||||
// RUN: %target-swift-emit-module-interface(%t/lazy/Test.swiftinterface) -module-name Test %s -disable-objc-attr-requires-foundation-module -experimental-lazy-typecheck
|
||||
// RUN: %target-swift-typecheck-module-from-interface(%t/lazy/Test.swiftinterface) -module-name Test
|
||||
// RUN: diff -u %t/baseline/Test.swiftinterface %t/lazy/Test.swiftinterface
|
||||
|
||||
// REQUIRES: objc_interop
|
||||
|
||||
@objc open class ObjCClass {
|
||||
public var publicVar: Int = 0
|
||||
@NSManaged public var managedVar: Int
|
||||
open func method() {}
|
||||
}
|
||||
|
||||
public final class FinalClass {
|
||||
@objc public dynamic var publicDynamicVar: Int {
|
||||
get { return 0 }
|
||||
set {}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user