Files
swift-mirror/test/ClangImporter/objc_direct.swift
Henrik G. Olsson cbc0ec3b88 Add -verify-ignore-unrelated where necessary (NFC)
These are tests that fail in the next commit without this flag. This
does not add -verify-ignore-unrelated to all tests with -verify, only
the ones that would fail without it. This is NFC since this flag is
currently a no-op.
2025-10-04 14:19:52 -07:00

28 lines
1.2 KiB
Swift

// RUN: %target-swift-frontend-verify -verify-ignore-unrelated -typecheck %s -enable-objc-interop -import-objc-header %S/../Inputs/objc_direct.h
// REQUIRES: objc_interop
var something = Bar() as AnyObject
something.directProperty = 123 // expected-error {{value of type 'AnyObject' has no member 'directProperty'}}
let _ = something.directProperty // expected-error {{value of type 'AnyObject' has no member 'directProperty'}}
something.directProperty2 = 456 // expected-error {{value of type 'AnyObject' has no member 'directProperty2'}}
let _ = something.directProperty2 // expected-error {{value of type 'AnyObject' has no member 'directProperty2'}}
let _ = something.directMethod() // expected-error {{value of type 'AnyObject' has no member 'directMethod'}}
let _ = something.directMethod2() // expected-error {{value of type 'AnyObject' has no member 'directMethod2'}}
class Foo {
// Test that we can use a method with the same name as some `objc_direct` method.
@objc func directProtocolMethod() -> String {
"This is not a direct method."
}
}
var otherThing = Foo() as AnyObject
// We expect no error.
let _ = otherThing.directProtocolMethod()