Commit Graph

15 Commits

Author SHA1 Message Date
Allan Shortlidge
cb578172ea Tests: Remove -disable-availability-checking in more tests that use concurrency.
Use the `%target-swift-5.1-abi-triple` substitution to compile the tests for
deployment to the minimum OS versions required for use of _Concurrency APIs,
instead of disabling availability checking.
2024-10-19 12:35:20 -07:00
Doug Gregor
1e2012d816 Disable availability checking in tests that use concurrency 2021-07-20 12:46:26 -07:00
Evan Wilde
b4f3daaad1 Fix actor init diagnostic
Instead of referring to the actor as a class that is missing the
initializer, call it an actor.
2021-06-11 07:16:25 -07:00
Slava Pestov
e805100f96 Sema: Fix source compatibility break with default initialization of optional properties
In Swift 4, properties declared with a sugared Optional type,
like Int?, have a default value of nil. This can be observed
in two ways:

- Classes and structs get an implicit no-argument initializer
- Designated initializers don't have to initialize this property

Note that this did not apply in general to properties where
the type was spelled explicitly as Optional<Int>, etc, mostly
because of implementation restrictions -- when we check if a
type has implicit initializers, we have not realized types for
all stored property members yet, and doing so is not really
possible without the iterative decl checker.

However, in some cases, we *did* perform default initialization
for Optional<Int>, because of some code duplication and
divergent code paths.

A recent refactoring cleaned up some of the mess in this area,
but accidentally broke source compatibility with code that
relied on the broken Optional<Int> case.

Fix this by simulating the old behavior in -swift-version 4,
and preserving the more correct behavior in -swift-version 5.

Fixes <rdar://problem/35319847>.
2017-11-04 23:40:24 -07:00
David Farler
b7d17b25ba Rename -parse flag to -typecheck
A parse-only option is needed for parse performance tracking and the
current option also includes semantic analysis.
2016-11-28 10:50:55 -08:00
Slava Pestov
06c676231b Sema: 'let' bindings are never default-initializable
There was an inconsistency between the logic for synthesizing
initializer expressions and the validation logic for the
@requires_stored_property_inits attribute. As a result, 'let'
bindings of optional types were not diagnosed in Sema, triggering
crashes in DI.

Swift SVN r32857
2015-10-24 03:55:52 +00:00
Chris Lattner
ada5487153 add fixit tests to random other tests.
Swift SVN r31006
2015-08-04 20:35:36 +00:00
Chris Lattner
7059871abf Convert some 'var' bindings to 'let' when they are not mutated, some
var/let bindings to _ when they are never used, and use some values that
are only written.  This is a testsuite cleanup, NFC. More to come.


Swift SVN r28406
2015-05-11 00:20:55 +00:00
Dmitri Hrybenko
3b04d1b013 tests: reorganize tests so that they actually use the target platform
Most tests were using %swift or similar substitutions, which did not
include the target triple and SDK.  The driver was defaulting to the
host OS.  Thus, we could not run the tests when the standard library was
not built for OS X.

Swift SVN r24504
2015-01-19 06:52:49 +00:00
Jordan Rose
2d480aa89f Remove duplicate checks for if a default no-argument initializer can be defined.
This condition is already checked from defineDefaultConstructor's only caller,
addImplicitConstructors, and the two conditions had drifted. This was causing
issues in the multi-file case, where the optionals hadn't been given an
explicit initial value yet.

rdar://problem/18716572

Swift SVN r23017
2014-10-30 18:53:13 +00:00
Doug Gregor
f77ffad141 Check whether we have an initializer *after* building default initializers.
This is a recent regression that caused us to reject globals of
optional type that didn't have initializers <rdar://problem/16953669>.

Swift SVN r18332
2014-05-18 17:24:17 +00:00
Chris Lattner
8781e36d75 Fix <rdar://problem/16906000> Implicitly unwrapped optional let is not considered initialized, but var is
by allowing default initializing let properties.  In classes, the property
is mutable in init, and the default initialization is useful.  The benefit we
gain by banning this is outweighed by the important usecases that get closed
off by doing so.


Swift SVN r18213
2014-05-16 21:04:40 +00:00
Chris Lattner
e383bac8f6 Rework default initialization of options to run much later, after all of the variables
have been type checked.  This allows us to reliably determine the type of the variable
and to know whether it actually needs default initialization or not.

This fixes:
<rdar://problem/16620121> Initializing constructor tries to initialize computed property overridden with willSet/didSet
which was because we were doing default initialization before computing override sets.

This does regress on one case, where our fiddly default init code isn't realizing that
a default initializer will be generated.  I fixme'd the case and filed:
<rdar://problem/16921173> implicit constructor synthesization runs too early

to track this.



Swift SVN r18094
2014-05-15 01:28:57 +00:00
Ted Kremenek
fad874708e Adjust test cases.
Swift SVN r17964
2014-05-12 22:01:52 +00:00
Doug Gregor
825e5be3d2 Default-initialize optional variables/properties to 'nil'.
Addresses <rdar://problem/16342813>.


Swift SVN r16222
2014-04-11 17:59:14 +00:00