Open
Description
Description
Forum Post: https://forums.swift.org/t/silfunction-type-mismatch-compiler-bug/64927
1. Apple Swift version 5.8 (swiftlang-5.8.0.124.2 clang-1403.0.22.11.100)
2. Compiling with the current language version
3. While evaluating request ExecuteSILPipelineRequest(Run pipelines { Mandatory Diagnostic Passes + Enabling Optimization Passes } on SIL for CKit)
4. While running pass #133 SILModuleTransform "MandatorySILLinker".
5. While deserializing SIL function "$s4BKit4ViewPAAE1aAA1BVyFZ"
6. *** DESERIALIZATION FAILURE ***
*** If any module named here was modified in the SDK, please delete the ***
*** new swiftmodule files from the SDK and keep only swiftinterfaces. ***
module 'BKit', builder version '5.8(5.8)/Apple Swift version 5.8 (swiftlang-5.8.0.124.2 clang-1403.0.22.11.100)', built from source, non-resilient, loaded from '/Users/kyle/Library/Developer/Xcode/DerivedData/BugKit-bafpkdzghmaihybwgaqdgxkaqvda/Build/Products/Debug-iphonesimulator/BKit.swiftmodule/arm64-apple-ios-simulator.swiftmodule'
SILFunction type mismatch
Steps to reproduce
Build the following package(min reproducible env):

Hint:
- If we remove "@_implementationOnly" in
B.swift
, the bug will not reappear.- If we remove "var b1" in
B.swift
, the bug will not reappear.- If we remove "class B2", the bug will not reappear.
- If we remove "View" protocol, the bug will not reappear.
- If we remove
CKit
, the bug will not reappear. (The bug will only appear ifBKit
was imported by other module)
Hint2:
Once you remove something to make it compile successfully, and make the change back.
It will still compile successfully. You need do a clean before build to reproduce the bug.
Expected behavior
Build successfully.
Environment
swift-driver version: 1.75.2 Apple Swift version 5.8 (swiftlang-5.8.0.124.2 clang-1403.0.22.11.100)
Target: arm64-apple-macosx13.0
Xcode 14.3
Build version 14E222b
Deployment target: iOS 16.4
The problem exists since Swift 5.5 when I was planning to support for SwiftPM with one of my company's internal framework, but only recently I find out the min reproducible env problem.
Metadata
Metadata
Assignees
Labels
A deviation from expected or documented behavior. Also: expected but undesirable behavior.The Swift compiler itselfBug: A crash, i.e., an abnormal termination of softwareFeature → types: function typesFlag: An issue whose reproduction requires multiple modulesArea → compiler: Serialization & deserializationFeature: types