The following hits a SIL verification error for asserts builds:
import Foundation
var a = 1
[a] as [NSNumber?]
SIL verification failed: EnumInst operand type does not match type of case
$NSNumber
$Int
Verifying instruction:
%17 = load [trivial] %16 : $*Int // user: %19
-> %19 = enum $Optional<NSNumber>, #Optional.some!enumelt, %17 : $Int // user: %20
store %19 to [init] %15 : $*Optional<NSNumber> // id: %20
But in noasserts builds it miscompiles
Seems like we're incorrectly inserting a BridgeFromObjCExpr instead of a BridgeToObjCExpr:
(brace_stmt implicit range=[main.swift:1270:1 - line:1270:18]
(coerce_expr type="[NSNumber?]" location=main.swift:1270:5 range=[main.swift:1270:1 - line:1270:18] written_type="[NSNumber?]"
(array_expr type="[NSNumber?]" location=main.swift:1270:1 range=[main.swift:1270:1 - line:1270:3] initializer="Swift.(file).Array extension.init(arrayLiteral:) [with (substitution_map generic_signature=<Element where Element : Copyable, Element : Escapable> Element -> NSNumber?)]"
(bridge_from_objc_expr implicit type="NSNumber?" location=main.swift:1270:2 range=[main.swift:1270:2 - line:1270:2]
(load_expr implicit type="Int" location=main.swift:1270:2 range=[main.swift:1270:2 - line:1270:2]
(declref_expr type="@lvalue Int" location=main.swift:1270:2 range=[main.swift:1270:2 - line:1270:2] decl="main.(file).a@main.swift:1269:5" function_ref=unapplied))))))))
The following hits a SIL verification error for asserts builds:
But in noasserts builds it miscompiles
Seems like we're incorrectly inserting a
BridgeFromObjCExprinstead of aBridgeToObjCExpr: