mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Add CGFloat (and other types that this applies to) as a trivial type even after the one-time initialization of the ForeignRepresentableCache. This allows let str = "" import Foundation let pt = CGPoint(x: 1.0, y: 2.0) to work. Before we would populate the cache the first time on the first line "let str = ..." and because the CoreGraphics module was not loaded we would not add CGFloat as a trivial type. When we come to query for CGFloat on the third line we would return NSNumber instead of CGFloat as a type and that would crash IRGen. rdar://31610342
15 lines
288 B
Swift
15 lines
288 B
Swift
// RUN: %target-repl-run-simple-swift | %FileCheck %s
|
|
|
|
// REQUIRES: swift_repl
|
|
|
|
// This used to crash.
|
|
|
|
let str = ""
|
|
import Foundation
|
|
let pt = CGPoint(x: 1.0, y: 2.0)
|
|
// CHECK: pt : CGPoint = (1.0, 2.0)
|
|
|
|
import simd
|
|
let f = float2(x: 1.0, y: 2.0)
|
|
// CHECK: f : float2 = float2(1.0, 2.0)
|