Skip to content

ManagedAtomic doesn't seem to work in test-cases #112

@ThrudTheBarbarian

Description

@ThrudTheBarbarian

If I have an I-var of a ManagedAtomic in a Swift framework, and then set up a test case in the same Xcode project, in the associated test target created by Xcode. Even importing "@testable" won't let me extend the class that contained the ManagedAtomic. It returns

"Cannot inherit from class 'QSEntity' because it has overridable members that could not be loaded"

Information

  • Package version: 1.2.0
  • Platform version: MacOS 14.3 (23D56)
  • Swift version:
swift-driver version: 1.87.3 Apple Swift version 5.9.2 (swiftlang-5.9.2.2.56 clang-1500.1.0.2.5)
Target: arm64-apple-macosx14.0

Checklist

  • If possible, I've reproduced the issue using the main branch of this package.
  • I've searched for existing reports of the same issue.

Steps to Reproduce

  • Set up a Swift framework project
  • Include the ManagedAtomics package using the package manager
  • Have a class with the following:
/*****************************************************************************\
|* Class definition
\*****************************************************************************/
class QSEntity : NSObject
	{
        ...
	/*************************************************************************\
	|* Model handling
	\*************************************************************************/
	private var nextModelIdValue : ManagedAtomic<Int64>	// Table's next model-id
        ...
        }
  • Set up a class in the associated tests project which imports the framework and extends the above Entity class
import Foundation
import OSLog
@testable import QuickSilver

/*****************************************************************************\
|* Class definition
\*****************************************************************************/
class TestEntity : QSEntity
        {
        }

Expected behavior

I'd expect a class containing a ManagedAtomic as an i-var to be importable into another class in the associated test target

Actual behavior

  • Set up as above
  • Notice that the error message Cannot inherit from class 'QSEntity' because it has overridable members that could not be loaded appears on the TestEntity declaration line.
  • Comment out the ManagedAtomic from the QSEntity class, ignoring any compilation issues where you've used it (for now)
  • Notice that the "Cannot inherit..." error goes away

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions