Files
swift-mirror/test/stdlib/IntegerDiagnostics.swift
Max Moiseev 90a20ea015 [stdlib] Resolve the ambiguity for Int32.init(bitPattern:)
When this initializer is invoked with an integer literal, the expression
is ambiguous, since both UIn32 and Float are
RepresentableByIntegerLiteral.

Fixes: https://bugs.swift.org/browse/SR-5176
2017-06-13 17:28:19 -07:00

8 lines
412 B
Swift

// RUN: %target-typecheck-verify-swift -swift-version 3
// RUN: %target-typecheck-verify-swift -swift-version 4
func signedBitPattern() {
_ = Int64(bitPattern: 0.0) // expected-error {{Please use Int64(bitPattern: UInt64) in combination with Double.bitPattern property.}}
_ = Int32(bitPattern: 0.0) // expected-error {{Please use Int32(bitPattern: UInt32) in combination with Float.bitPattern property.}}
}