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-6384] Adding parameter with default value fails with linker error #48934

Open
NachoSoto opened this issue Nov 14, 2017 · 3 comments
Open
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself

Comments

@NachoSoto
Copy link
Contributor

Previous ID SR-6384
Radar None
Original Reporter @NachoSoto
Type Bug
Environment

Xcode Version 9.1 (9B55)
Swift version 4.0.2 (swiftlang-900.0.69.1 clang-900.0.38)

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

md5: 8cb41ae2b88353d7b3a39229de2db80c

Issue Description:

Scenario:

Module A:

public final class C {
  public init(a: Int) {}
}

Module B:

func f() {
  let _ = C(a: 0)
}

Upon compiling this, I changed module A:

class C {
  init(a: Int, b: Bool = false) {}
}

Expected result:

Incremental compilation leads to Module B getting recompiled (or whatever needs to happen), and things work.

Actual result:

Undefined symbols for architecture arm64:
  "__T02UI12CardCellViewCACSb13displayShadow_SC6CGRectV12initialFrameSb6cached12CoreGraphics7CGFloatV7paddingtcfC", referenced from:
      __T02UI15CardLibraryCell33_2ABB1494CE3CB6681FDE7B05F9E507C1LLCADSC6CGRectV5frame_tcfc in CardDashboardViewController.o
      __T02UI16CombinedCardViewC04cardD033_0290C3EDF9FFAA02DAA34A4BAEC3322DLLAA0c4CellD0CfgAGycfU_ in CombinedCardView.o
  "__T02UI12CardCellViewCACSb13displayShadow_SC6CGRectV12initialFrameSb6cached12CoreGraphics7CGFloatV7paddingtcfcfA1_", referenced from:
      __T02UI15CardLibraryCell33_2ABB1494CE3CB6681FDE7B05F9E507C1LLCADSC6CGRectV5frame_tcfc in CardDashboardViewController.o
      __T02UI16CombinedCardViewC04cardD033_0290C3EDF9FFAA02DAA34A4BAEC3322DLLAA0c4CellD0CfgAGycfU_ in CombinedCardView.o
  "__T02UI12CardCellViewCACSb13displayShadow_SC6CGRectV12initialFrameSb6cached12CoreGraphics7CGFloatV7paddingtcfcfA2_", referenced from:
      __T02UI15CardLibraryCell33_2ABB1494CE3CB6681FDE7B05F9E507C1LLCADSC6CGRectV5frame_tcfc in CardDashboardViewController.o
      __T02UI16CombinedCardViewC04cardD033_0290C3EDF9FFAA02DAA34A4BAEC3322DLLAA0c4CellD0CfgAGycfU_ in CombinedCardView.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

(Obviously those are from the real example). Module B didn't see the change, because the invocation to C(a: 0) was still valid, leading to a linker error.

Note: this is similar to SR-1171, which is probably still an issue.

@belkadan
Copy link
Contributor

Can you reproduce this in a standalone example? The above code can't be what you were using because there are no public annotations in it.

@NachoSoto
Copy link
Contributor Author

I haven't tried. As seen in my error, that's from my real project. I updated the example to add public annotations.
I don't have time to re-create a sample project though, but I'm 100% confident in the steps I took to reproduce this.

@belkadan
Copy link
Contributor

Mmk, thanks.

@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
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself
Projects
None yet
Development

No branches or pull requests

2 participants