Files
swift-mirror/test/ClangImporter/generic_compatibility_alias.swift
Gabor Horvath 6d24c52b80 [cxx-interop] Use the locations imported from C++
A recent PR (#77204) started to import C++ source locations into Swift.
This PR flips a switch so these locations are actually used more widely.
Now some of the diagnostic locations are changed, but they generally
improved the quality of the diagnostics, pointing out conformances
imported from Obj-C code right when they are declared.
2024-11-01 13:49:09 +00:00

24 lines
841 B
Swift

// RUN: %empty-directory(%t)
// RUN: %build-clang-importer-objc-overlays
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk-nosource -I %t) -module-name generic_compat_alias -I %S/Inputs/custom-modules -typecheck -verify %s
// REQUIRES: objc_interop
// REQUIRES: OS=macosx
import ObjectiveC
import Foundation
import ObjCIRExtras
func foo(_: SwiftConstrGenericNameAlias<String>) {
// expected-error@-1 {{'SwiftConstrGenericNameAlias' requires that 'String' inherit from 'NSNumber'}}
// TODO: validate node in imported Obj-C header.
}
func faz(_: SwiftGenericNameAlias<Int>) {
// expected-error@-1 {{'SwiftGenericNameAlias' requires that 'Int' be a class type}}
// TODO: validate node in imported Obj-C header.
}
func bar(_: SwiftGenericNameAlias<NSNumber>) {} // Ok
func baz<T: AnyObject>(_: SwiftGenericNameAlias<T>) {} // Ok