Files
swift-mirror/test/SILOptimizer/diagnostic_constant_propagation-swift4.swift
Pavel Yaskevich aa9b3d8474 [TypeChecker] SE-0213: Implement literal init via coercion
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
2018-07-17 12:08:59 -07:00

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}}
}