Files
swift-mirror/test/SILOptimizer/constant_propagation_diagnostics.swift
Michael Gottesman f10b45b540 [ownership] Add an extra run of -Onone tests with diagnostics with -enable-ownership-stripping-after-serialization enabled.
Right now the stdlib/overlays can compile against -Onone tests with or without
-enable-ownership-stripping-after-serialization. This will help me to prevent
other work going on from breaking these properties.
2019-10-26 15:12:14 -07:00

15 lines
805 B
Swift

// RUN: %target-swift-frontend -emit-sil -sdk %S/../SILGen/Inputs %s -o /dev/null -verify
// RUN: %target-swift-frontend -enable-ownership-stripping-after-serialization -emit-sil -sdk %S/../SILGen/Inputs %s -o /dev/null -verify
// <rdar://problem/18213320> enum with raw values that are too big are not diagnosed
enum EnumWithTooLargeElements : UInt8 {
case negativeOne = -1 // expected-error 2 {{negative integer '-1' overflows when stored into unsigned type 'UInt8'}}
case one = 1
case two = 2
case three
case twoHundredFiftyFour = 254
case twoHundredFiftyFive
case twoHundredFiftySix // expected-error 2 {{integer literal '256' overflows when stored into 'UInt8'}}
case tooFarByFar = 123456 // expected-error 2 {{integer literal '123456' overflows when stored into 'UInt8'}}
}