Commit Graph

7 Commits

Author SHA1 Message Date
Slava Pestov
2c53876c19 ASTPrinter: Fix printing of let properties inside @objc @implementation extensions
A `let` here is really just a `var` with a `{ get }`.

Fixes rdar://problem/127120469.
2025-06-06 00:25:02 -04:00
Becca Royal-Gordon
29a2d32d0e Avoid objcImpl @_hasStorage in module interfaces
If an `@objc implementation extension` had a public stored property with an observer, Swift would print `@_hasStorage` on the extension. This is Not Good because in a module interface, an objcImpl extension appears to be an ordinary extension, and properties in ordinary extensions are not supposed to have storage.

Suppress printing this attribute in objcImpl extensions to avoid this problem.

Partially fixes rdar://144811653 by suppressing emission of bad attributes.
2025-03-27 16:51:16 -07:00
Becca Royal-Gordon
b3e7a23e70 Fix @objc use in module interfaces for objcImpl
objcImpl extensions with final public members need to be printed into module interfaces, but with the @implementation attribute suppressed. That worked fine…but when we switched to the new syntax, we should also have suppressed the @objc attribute, and we mistakenly did not. Correct this oversight.

Fixes rdar://129178360.
2024-06-04 17:47:05 -07:00
Becca Royal-Gordon
6d3e1ad794 Fix -target in several objcImpl tests 2024-04-30 12:03:46 -07:00
Becca Royal-Gordon
ab5d3ac42c [NFC] Verify ModuleInterface/objc_implementation
Switch the ModuleInterface/objc_implementation.swift test to using standard substitutions to properly emit its module interface, and make sure it also verifies.
2023-03-25 14:53:29 -07:00
Becca Royal-Gordon
e8c43bb168 Fix @objcImpl subclass init visibility computation
When writing an @objc subclass of an @objcImplementation class, implicit initializers in the subclass were treated as overriding the *implementation decl*, not the *interface decl*, of the initializer in the superclass. This caused Swift to incorrectly compute the visibility of the superclass initializer and omit an `override` keyword from the module interface when one would definitely be necessary.

Correct this oversight by looking up the interface decl matching the superclass implementation in `collectNonOveriddenSuperclassInits()`.
2023-03-25 14:53:29 -07:00
Becca Royal-Gordon
04a27b822c Omit @objcImpl from module interfaces
Module interfaces should not include the @objcImplementation attribute, member implementations that are redundant with the ObjC header, or anything that would be invalid in an ordinary extension (e.g. overridden initializers, stored Swift-only properties).
2023-03-25 14:53:29 -07:00