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-6105] Combination of generics, enums, and autoclosures can produce an undefined symbol #48660

Closed
tjw opened this issue Oct 10, 2017 · 5 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself regression swift 4.0

Comments

@tjw
Copy link
Contributor

tjw commented Oct 10, 2017

Previous ID SR-6105
Radar rdar://problem/34911378
Original Reporter @tjw
Type Bug
Status Resolved
Resolution Done

Attachment: Download

Environment

Xcode 9.1 beta 1 or beta 2. This worked OK in Xcode 9.0.

Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, 4.0Regression
Assignee None
Priority Medium

md5: fe8747ed0afe722e4affab938c9b4159

Issue Description:

Some combination of generics and enums can produce an undefined symbol between two different targets (in this case, a unit test and a framework).

Steps to reproduce:

  • Download and unzip the attached example

  • Open OmniGroup/Workspaces/OmniJS.xcworkspace

  • cmd-u to build and test

Expected result:

  • The test should compile and link

Actual result:

  • Link error:

Undefined symbols for architecture x86_64:
"__T0So12NSColorSpaceC5ModelOs16RawRepresentable6OmniJSWP", referenced from:
_T011OmniJSTests9EnumTestsC9testValueyyFSbyKXKfu in EnumTests.o
__T0So12NSColorSpaceC5ModelOs9Equatable6AppKitsAEP2eeoiSbx_xtFZTW in EnumTests.o

Notes:

  • The test that gets the undefined symbol doesn't actually use any of the generics goop.

  • The test has a second file that just imports the framework; if that import is removed, the bug doesn't happen

  • If the reference to the enum is made outside of the XCTAssert, the problem doesn't happen.

@belkadan
Copy link
Contributor

Don't feel like inventing a "4.0.1Regression" tag. Thanks for the reduced test case!

@swift-ci create

@belkadan
Copy link
Contributor

A +Asserts build of near-master results in an assertion failure in module merging, which is probably related.

Assertion failed: (conformance->isComplete()), function writeNormalConformance, file /Volumes/Data/swift-public/swift/lib/Serialization/Serialization.cpp, line 1331.

Unfortunately, there's no PrettyStackTrace info to determine which conformance this is, but it's almost certainly the one for NSColorSpace.Model to either Equatable or RawRepresentable given the failure above.

Also confirmed that this works fine in 9.0.0.

@DougGregor
Copy link
Member

#12471

@DougGregor
Copy link
Member

Merged to master as 787fe55

@DougGregor
Copy link
Member

Merged to 4.0 branch in e004d80

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself regression swift 4.0
Projects
None yet
Development

No branches or pull requests

4 participants