Skip to content

Conversation

@Xazax-hun
Copy link
Contributor

This was behind a feature flag. Unfortunately, this flag is viral, if the module we consume and the consuming module had inconsistent settings that could lead to deserialization errors. To avoid this, we need to move this out of the flag and apply the attribute unconditionally. This PR moves addressable-self out of the experimental flag and addresses a couple of the fallouts:

  • This attribute should not be applied to types with reference semantics like foreign reference types or Obj-C classes.
  • There was a SILGen assertion failure which is solved by pealing off the @lvalue specifier from the type behind a load expression.

This fixes part of rdar://155971658

@Xazax-hun Xazax-hun added the c++ interop Feature: Interoperability with C++ label Jul 24, 2025
@Xazax-hun Xazax-hun force-pushed the addressable-self-unconditional branch from e380f53 to a5900a2 Compare July 24, 2025 11:48
Copy link
Contributor

@egorzhdan egorzhdan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice

Copy link
Contributor

@j-hui j-hui left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@Xazax-hun Xazax-hun force-pushed the addressable-self-unconditional branch from a5900a2 to 628d111 Compare July 24, 2025 14:35
@Xazax-hun Xazax-hun requested a review from hnrklssn as a code owner July 24, 2025 14:35
@Xazax-hun Xazax-hun force-pushed the addressable-self-unconditional branch from 628d111 to 1891523 Compare July 25, 2025 14:40
This was behind a feature flag. Unfortunately, this flag is viral, if
the module we consume and the consuming module had inconsistent settings
that could lead to deserialization errors. To avoid this, we need to
move this out of the flag and apply the attribute unconditionally. This
PR moves addressable-self out of the experimental flag and addresses a
couple of the fallouts:
* This attribute should not be applied to types with reference semantics
  like foreign reference types or Obj-C classes.
* There was a SILGen assertion failure which is solved by pealing off
  the @lvalue specifier from the type behind a load expression.

This fixes part of rdar://155971658
@Xazax-hun Xazax-hun force-pushed the addressable-self-unconditional branch from 1891523 to 9525aee Compare July 26, 2025 07:37
@Xazax-hun
Copy link
Contributor Author

@swift-ci please test

@Xazax-hun Xazax-hun merged commit c13957a into main Jul 26, 2025
5 checks passed
@Xazax-hun Xazax-hun deleted the addressable-self-unconditional branch July 26, 2025 16:00
Xazax-hun pushed a commit to Xazax-hun/swift that referenced this pull request Aug 18, 2025
After swiftlang#83289 and swiftlang#82879 landed we should no longer get deserialization
failures and this feature is no longer behind a flag. This patch also
changes how we query if a function's return value depends on self.
Previously, we queried the lifetime dependencies from the Swift
declaration. Unfortunately, this is problematic as we might have not
finished fully importing the types in the function signature just yet
and the compiler might end up populating the conformance tables
prematurely. To work this around, I store functions with self-dependent
return values where lifetimes are computed in the importer for later
use.

The PR also adds a test to make sure the addressable dependency feature
will not result in deserialization errors.

rdar://155319311&154213694&112690482&128293252
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c++ interop Feature: Interoperability with C++

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants