Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SR-15453] Symbol collision in enum case initializers in library evolution mode #57758

Open
jirid opened this issue Nov 7, 2021 · 0 comments
Labels
compiler The Swift compiler in itself

Comments

@jirid
Copy link
Contributor

jirid commented Nov 7, 2021

Previous ID SR-15453
Radar None
Original Reporter @jirid
Type Sub-task
Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Sub-task
Assignee None
Priority Medium

md5: 2d294cd39397f2168345452e8e3d5a83

Parent-Task:

Issue Description:

This issue manifests in library evolution mode only. It affects enums that have cases that differ in associated value labels only (i.e. they have the same base name, number, order, and types of associated values).

The following code:

public enum Foo {
  case foo(bar: Int)
  case foo(bas: Int)
}

when compiled in library evolution mode:

swiftc -enable-library-evolution -emit-library

does not contain an initializer for each enum case.

Running:

nm <library> | swift demangle

produces one symbol for:

S enum case for Foo.foo(Foo.Type) -> (Swift.Int) -> Foo

the expected number of such symbols is 2, one for each case in the enum.

The name mangling algorithm does not take associated value labels into account, therefore each initializer is emitted under the same mangled name by the compiler.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler The Swift compiler in itself
Projects
None yet
Development

No branches or pull requests

1 participant