Skip to content

Lifetime inference: implicit subscript getter depenency + implicit _modify #83690

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

Merged
merged 3 commits into from
Aug 14, 2025

Conversation

atrick
Copy link
Contributor

@atrick atrick commented Aug 13, 2025

  • Lifetime inference: give subscripts an implicit dependency on 'self'
    Allow a subscript getter to return a non-Escapable type without an explicit
    '@'lifetime annotation.

    subscript(_ index: Int) -> Span {
      get {} // OK
    }
    
  • Lifetime inference: fix a crash on implicit _modify for subscripts.
    Fixes rdar://155976839 (Compiler crash when _modify is not specified for
    ~Escapable type)

  • Lifetime test: implicit subscript getter depenency, implicit _modify

atrick added 3 commits August 12, 2025 22:02
Allow a subscript getter to return a non-Escapable type without an explicit
'@'lifetime annotation.

    subscript(_ index: Int) -> Span {
      get {} // OK
    }
Fixes rdar://155976839 (Compiler crash when _modify is not specified for
~Escapable type)
@atrick atrick requested a review from meg-gupta August 13, 2025 05:05
@atrick
Copy link
Contributor Author

atrick commented Aug 13, 2025

@swift-ci test

Copy link
Contributor

@meg-gupta meg-gupta left a comment

Choose a reason for hiding this comment

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

lgtm

@atrick
Copy link
Contributor Author

atrick commented Aug 13, 2025

error: /tmp/Miscellaneous_TestDiscovery_Simple.ApahId/Miscellaneous_TestDiscovery_Simple/Tests/SimpleTests/SwiftTests.swift:2:18 module 'Simple' was not compiled for testing

😞

@atrick
Copy link
Contributor Author

atrick commented Aug 13, 2025

@swift-ci smoke test linux

@atrick atrick merged commit 44bd40d into swiftlang:main Aug 14, 2025
4 of 5 checks passed
@atrick atrick deleted the fix-infer-subscript branch August 14, 2025 16:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants