Files
swift-mirror/test/decl/enum/bool_raw_value.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

29 lines
1.1 KiB
Swift

// RUN: %target-typecheck-verify-swift -verify-ignore-unrelated
extension Bool: @retroactive ExpressibleByIntegerLiteral {
public init(integerLiteral value: Int) {
self = value != 0
}
}
enum IsDefinitelyRecursive : Bool, Equatable, Hashable {
case recursive=false
}
// expected-error@+2 {{'IsRecursive' declares raw type 'Bool', but does not conform to RawRepresentable and conformance could not be synthesized}}
// expected-note@+1 {{add stubs for conformance}}
enum IsRecursive : Bool, Equatable, Hashable {
case recursive=false
case nonrecursive // expected-error{{enum case must declare a raw value when the preceding raw value is not an integer}}
}
enum IsRecursiveBad1Integral : Bool, Equatable, Hashable {
case recursive = 0
case nonrecursive
}
// expected-error@+2 {{'IsRecursiveBad2' declares raw type 'Int', but does not conform to RawRepresentable and conformance could not be synthesized}}
// expected-note@+1 {{add stubs for conformance}}
enum IsRecursiveBad2 : Int, Equatable, Hashable {
case recursive = false // expected-error{{cannot convert value of type 'Bool' to raw type 'Int'}}
}