mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
We deprecated overriding it in 4.2 with a custom compiler warning. This removes the ability to override it entirely. The correct way to customize hashing for NSObject subclasses is to override the `hash` property.
16 lines
626 B
Swift
16 lines
626 B
Swift
// RUN: %target-typecheck-verify-swift
|
|
// RUN: %target-swift-frontend -c -verify -verify-ignore-unknown %s -o /dev/null
|
|
|
|
// REQUIRES: objc_interop
|
|
|
|
import ObjectiveC
|
|
|
|
class Foo: NSObject {
|
|
override var hashValue: Int { // expected-error {{overriding non-open property outside of its defining module}} expected-error {{overriding non-@objc declarations from extensions is not supported}}
|
|
return 0
|
|
}
|
|
|
|
override func hash(into hasher: inout Hasher) { // expected-error {{overriding non-open instance method outside of its defining module}} expected-error {{overriding declarations in extensions is not supported}}
|
|
}
|
|
}
|