Commit Graph

9 Commits

Author SHA1 Message Date
Robert Widmann
c9b316433a Correct the DeclContext Used For 'super.init()' Synthesis
When a subclass inherits from a superclass that declares a no-args
desginated initializer and no other visible inits, the subclass may
elide calls to 'super.init()'. The way this was enforced was by looking
into the superclass *from the subclass' init*, not from the subclass.
This ensured that not only would we get results for initializers, we'd
get results for initializers that were actually _callable_ from the
subclass.

The changes in apple/swift#33515 accidentally swapped the decl context
here, which caused this lookup to start returning additional results.
In that case, we consider it ambiguous as to which designated
initializer we should synthesize, and so we bail.

The net result is DI errors where there previously were none. Let's put
this back in order.

rdar://67560590, rdar://67686660, rdar://67690116, SR-13427
2020-08-24 16:12:13 -07:00
Michael Gottesman
46432404f3 [ownership] Remove dead option: enable-ownership-stripping-after-serialization.
We always lower ownership now after the diagnostic passes (what this option
actually controlled). So remove it.

NFC.
2020-06-16 10:52:02 -07:00
Ravi Kandhadai
4e5389dacb [Definite Initialization] Improve diagnostics for delegating, failable
initializers that do not initialize along all paths.

<rdar://problem/62562254>
2020-05-04 22:00:18 -07:00
Michael Gottesman
f10b45b540 [ownership] Add an extra run of -Onone tests with diagnostics with -enable-ownership-stripping-after-serialization enabled.
Right now the stdlib/overlays can compile against -Onone tests with or without
-enable-ownership-stripping-after-serialization. This will help me to prevent
other work going on from breaking these properties.
2019-10-26 15:12:14 -07:00
Saleem Abdulrasool
2c0999f67f test: port most SILOptimizer tests for Windows
This adjusts the SILOptimizer test suite to work on Windows.  The
remaining SILOptimizer test failure is a memory issue in the standard
library.
2018-12-24 00:57:25 -08:00
Jordan Rose
85e84a85ef DI: Handle cross-module initializers for empty structs in pre-Swift-5
These also have to delegate to another initializer even though there
are no stored properties to initialize.
2017-11-10 14:10:14 -08:00
Jordan Rose
8bf0b0c010 [test] Add a cross-module struct initializer test with private fields 2017-11-10 11:25:14 -08:00
Jordan Rose
7ff98f3ee8 DI: Suggest "self.init()" for C structs in Swift 5 mode too
...being careful to only do it once per initializer. Additionally,
/don't/ offer the suggestion if there was already a conditional
assignment to 'self', because that would wipe it out and the user
should think harder.
2017-11-10 11:15:33 -08:00
Jordan Rose
14198a360c Treat cross-module struct initializers as delegating in Swift 5
(and when the struct in question is non-fixed-layout, which was
already implemented)

This ensures that these initializers are never fieldwise in Swift 5
mode, which makes it safe for library authors to add new fields.
2017-11-10 10:59:24 -08:00