Files
swift-mirror/test/Serialization/Recovery/error-sil-function.swift
Alexis Laferrière 9bf0b6be05 [SIL Serialization] Print mismatching SILFunction types on error
The crash on `SILFunction type mismatch` provides little information and
tends to be difficult to reproduce. Let's print some of the available
information and distinguish the two failure sites.

I'm not confident all required information is written down so we may
need to improve this further in the future. This version still crashes
the compiler, we may want a proper type-check to prevent this failure
with a clean diagnostic for the example used here.

rdar://53821031
2023-05-03 17:24:55 -07:00

14 lines
402 B
Swift

// RUN: not --crash %target-swift-frontend -c %s 2>&1 | %FileCheck %s
// CHECK: *** DESERIALIZATION FAILURE ***
// CHECK: SILFunction type mismatch for 'asinf': '$@convention(thin) (Float) -> Float' != '$@convention(c) (Float) -> Float'
// REQUIRES: VENDOR=apple
import Darwin
@_silgen_name("asinf") internal func quux(_ x: Float) -> Float
public func bar(_ x: Float) -> Float {
return quux(x)
}