Files
swift-mirror/test/Constraints/observable_macro_shadowing.swift
Pavel Yaskevich cf257aa64a [PreCheck] Filter out macro declarations from result set
Move logic from `ConstraintGenerator::visitOverloadedDeclRefExpr`
to pre-check to avoid including macro declarations referenced
without `#`. This means that pre-checking would synthesize
`TypeExpr` in situations when there is a type reference that
is shadowed by a stdlib macro.

Resolves: https://github.com/apple/swift/issues/67815
Resolves: rdar://114796811
2023-08-31 17:30:14 -07:00

39 lines
902 B
Swift

// RUN: %empty-directory(%t/src)
// RUN: %empty-directory(%t/sdk)
// RUN: split-file %s %t/src
// RUN: %target-swift-frontend -emit-module %t/src/Test.swift \
// RUN: -module-name Test -swift-version 5 -enable-library-evolution \
// RUN: -emit-module-path %t/Test.swiftmodule
// RUN: %target-swift-frontend -typecheck %t/src/main.swift \
// RUN: -module-name main -I %t -verify
// REQUIRES: swift_swift_parser
// REQUIRES: observation
//--- Test.swift
public protocol ObservableConvertibleType {
associatedtype Element
}
public protocol ObservableType : ObservableConvertibleType {}
public class Observable<Element> : ObservableType {
}
extension ObservableType {
public static func empty() -> Observable<Element> { fatalError() }
}
//--- main.swift
import Test
import Observation
extension Observable {
func test() -> Observable<Bool> {
return Observable<Bool>.empty()
}
}