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-1129] Linker step fails when subclassing a class with a 'public private(set) var' #395

Closed
modocache mannequin opened this issue Apr 3, 2016 · 2 comments
Closed

Comments

@modocache
Copy link
Mannequin

modocache mannequin commented Apr 3, 2016

Previous ID SR-1129
Radar None
Original Reporter @modocache
Type Bug
Status Closed
Resolution Done
Environment
  • Ubuntu 15.10, Linux x86_64

  • Swift commit 4c57791 (Sat Apr 2 10:46:18 2016 -0700)

Additional Detail from JIRA
Votes 0
Component/s Compiler, XCTest
Labels Bug, Linux
Assignee @eeckstein
Priority Medium

md5: 72f6e819d92013f961797857f3f1a7cb

relates to:

  • SR-272 Linker error: Undefined reference to _TFC10Foundation8NSObjectg9_cfTypeIDSu
  • SR-1901 Linker error "hidden symbol" on subclassing Thread

Issue Description:

Pull request apple/swift#2039 adds tests demonstrating the problem. Namely, the following test fails on Linux:

// test/Parse/Inputs/public_var_private_setter.swift
public class BaseClass {
       public internal(set) var variable: Int = 0
}
// test/Parse/use_public_var_private_setter.swift
// RUN: %target-build-swift -emit-module -emit-library %S/Inputs/public_var_private_setter.swift
// RUN: %target-build-swift -I . -L . -lpublic_var_private_setter %s -o use_public_var_private_setter

// On Linux, the linker step of this test fails with "Bad value", specifically:
// "hidden symbol `_TFC25public_var_private_setter9BaseClasscfT_S0_' isn't defined".
// XFAIL: linux

import public_var_private_setter

class Class: BaseClass {}

This is the underlying issue behind https://bugs.swift.org/browse/SR-272, and behind this workaround in swift-corelibs-xctest:

/// - Note: FIXME: This property should be readonly, but currently has to be publicly settable due to a
/// toolchain bug on Linux. To ensure compatibility of tests between
/// swift-corelibs-xctest and Apple XCTest, this property should not be modified.
public var name: String

@modocache
Copy link
Mannequin Author

modocache mannequin commented Sep 21, 2016

Another example of this affecting corelibs API: apple/swift-corelibs-foundation#651

@modocache
Copy link
Mannequin Author

modocache mannequin commented Sep 23, 2016

Fixed in https://bugs.swift.org/browse/SR-1901. Thanks!!

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@shahmishal shahmishal transferred this issue from apple/swift May 9, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

0 participants