Skip to content

SILFunction type mismatch #65849

Open
Open
@Kyle-Ye

Description

@Kyle-Ye

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):

image

BugKit.zip

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 if BKit 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

No one assigned

    Labels

    SILbugA deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itselfcrashBug: A crash, i.e., an abnormal termination of softwarefunction typesFeature → types: function typesmultiple modulesFlag: An issue whose reproduction requires multiple modulesserializationArea → compiler: Serialization & deserializationswift 5.8typesFeature: types

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions