mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Implementation is as follows: In `preCheckExpression` try to detect if there is `T(literal)` call in the AST, replace it with implicit `literal as T`, while trying to form type-checked AST, after constraint solving, restore source information and drop unnecessary coercion expression. Resolves: rdar://problem/17088188 Resolves: rdar://problem/39120081 Resolves: rdar://problem/23672697 Resolves: rdar://problem/40379985
9 lines
371 B
Swift
9 lines
371 B
Swift
// RUN: %target-swift-frontend -swift-version 4 -emit-sil -primary-file %s -o /dev/null -verify
|
|
//
|
|
// These are tests for diagnostics produced by constant propagation pass.
|
|
// These are specific to Swift 4.
|
|
|
|
func testArithmeticOverflowSwift4() {
|
|
var _ = Int8(126) + (1 + 1) // expected-error {{arithmetic operation '126 + 2' (on type 'Int8') results in an overflow}}
|
|
}
|