Commit Graph

9699 Commits

Author SHA1 Message Date
Arnold Schwaighofer
315f47d19d Diagnostic: dynamic replacement and replaced function's @objc attribute must match
rdar://48259565
2019-02-21 08:12:51 -08:00
swift-ci
1a66c77110 Merge pull request #21067 from ravikandhadai/yieldcheck 2019-02-20 17:27:08 -08:00
David Ungar
c9576ca068 Move LegacyUnqualifiedLookup out of header 2019-02-20 16:16:16 -07:00
David Ungar
306cfd8a4f Constification 2019-02-20 15:32:49 -07:00
David Ungar
cd48cd6eb3 Format 2019-02-20 14:35:52 -07:00
David Ungar
1595efe5e2 Split the file, unfmt 2019-02-20 14:34:11 -07:00
Joe Groff
0cfca9496a Give opened archetypes a generic environment.
And maybe allow nested types to live on them.
2019-02-20 12:52:48 -08:00
Ravi Kandhadai
a9b0ebe542 [SIL Diagnostics] Create a mandatory pass to check correct usage of
yields in generalized accessors: _read and _modify, which are
yield-once corountines. This pass is based on the existing SIL verifier
checks but diagnoses only those errors that can be introduced by programmers
when using yields.

<rdar://43578476>
2019-02-19 18:25:47 -08:00
Slava Pestov
69d1cafd1c AST: Add AvailabilityContext parameter to Decl::isWeakImported()
For now, it's not used, but we do try to pass the right value down from
our various call sites.

Progress on <rdar://problem/46674512>.
2019-02-19 18:58:44 -05:00
Slava Pestov
7ffa09557d AST: Introduce AvailabilityContext::forDeploymentTarget() 2019-02-19 18:57:30 -05:00
David Ungar
edaec2aea5 Move searchPlacesToSearch into PlacesToSearch 2019-02-19 11:24:51 -07:00
David Ungar
ef9f99e37c Rename ExpUnqalifiedLookup to UnqualifiedLookup, UnqualifiedLookup to LegacyUnqualifiedLookup 2019-02-19 10:55:44 -07:00
Slava Pestov
8fa74fabc3 Merge pull request #22664 from slavapestov/always-emit-into-client
SIL: Introduce '@_alwaysEmitIntoClient' attribute for use by standard library
2019-02-18 22:36:56 -05:00
Brent Royal-Gordon
ab827a9821 Merge pull request #22686 from brentdax/what-a-dump
Add ASTNode.dump() methods
2019-02-18 15:03:56 -08:00
David Ungar
0aee0dba4b 1st cut finish redo, unfmt 2019-02-18 15:30:18 -07:00
Slava Pestov
bd6490b391 SIL: Introduce '@_alwaysEmitIntoClient' attribute for use by standard library
This is like '@inlinable', except that the symbol does not have a public
entry point in the generated binary at all; it is deserialized and a copy
is always emitted into the client binary, with shared linkage.

Just like '@inlinable', if you apply this to an internal declaration it
becomes '@usableFromInline' automatically.

This uses the same mechanism as default arguments ever since Swift 4, so
it should work reasonably well, but there are rough edges with diagnostics
and such. Don't use this if you are not the standard library.

Fixes <rdar://problem/33767512>, <https://bugs.swift.org/browse/SR-5646>.
2019-02-18 17:10:57 -05:00
Slava Pestov
112f6e027c Sema: Remove @noreturn attribute support
Swift 5 removed Swift 3 mode, but kept some diagnostic code around to emit
a fixit. It's time to remove that now.
2019-02-18 16:50:36 -05:00
technicated
91f0ca2ff9 Removed some now-unnecessary diagnostic / check
unsupported_keypath_tuple_element_reference
expr_keypath_unimplemented_tuple
2019-02-18 10:19:43 +01:00
technicated
bad2230ccd Private constructor for tuple element kind keypath in AST 2019-02-18 10:19:42 +01:00
technicated
a0ed29d326 🎄 Improved tuple key path support in SIL ~ Merry Christmas 🎄
Using an anonymous union in KeyPathPatternComponent instead of the weird void * in SetterAndIdKind
Added TupleElement kind to KeyPathComponentKindEncoding
Written basic SIL keypath serialization tests
Deleted or edited some old Swift-level tuple key path tests
2019-02-18 10:15:58 +01:00
Andrea Tomarelli
85df714f5b Fixed 'kind' check in KeyPathExpr::Component constructor 2019-02-18 09:04:43 +01:00
Andrea Tomarelli
6a462b131b Made a union in KeyPathExpr anonymous 2019-02-18 09:04:43 +01:00
Andrea Tomarelli
834ef2c253 Renamed fieldNumber to tupleIndex in AST & Sema 2019-02-18 09:04:42 +01:00
Andrea Tomarelli
ede47cafbd Partial AST & Sema implementation of TKP 2019-02-18 09:04:42 +01:00
Brent Royal-Gordon
e6af2e4ad9 Add ASTNode.dump() methods 2019-02-17 22:14:21 -08:00
David Ungar
977b0db93d Nonfmt cut down on DC 2019-02-16 23:35:25 -07:00
David Ungar
3c295f8228 Group lookupDecls etc into PlacesToSearch 2019-02-16 22:43:10 -07:00
David Ungar
8ece21459b Push GenericParamList check into function case. 2019-02-16 11:55:41 -07:00
David Ungar
3b7131cf0b Factor each variant into a separate function. Facter out Decl dispatch. 2019-02-16 11:49:07 -07:00
David Ungar
e9298a1ee0 Renamed shouldReturnBasedOnResults to isFinishedWithLookupNowThatIsAboutToLookForOuterResults 2019-02-16 11:34:43 -07:00
David Ungar
04ef0daeb8 Add ExpUnqualifiedLookup, cross-check 2019-02-16 11:31:16 -07:00
fischertony
bb9482bab5 [CodeCompletion][Parser] Completions for overridable static members 2019-02-16 16:02:06 +03:00
Doug Gregor
7d6af9040c Merge pull request #22659 from DougGregor/no-declcontext-local-protocol-sorting
Eliminate "sorting" of DeclContext-local protocols / conformances.
2019-02-15 20:27:00 -08:00
swift-ci
57924c2d30 Merge pull request #22605 from brentdax/all-in-the-family 2019-02-15 18:51:23 -08:00
Doug Gregor
d31ef61a28 Eliminate "sorting" of DeclContext-local protocols / conformances.
Sorting of DeclContext-local protocols and conformances shouldn't ever
be necessary, because the underlying data structures that produce
these lists should be deterministic. Sorting can hide any
non-determinism, so stop doing it and we can address the underlying
nondeterminism.
2019-02-15 14:16:48 -08:00
Nate Cook
e32ad7830a Revise error for incorrect subscript parameters.
We use subscripts for more than just indexes in Swift these days, so
the error message needs to be a bit more general.
2019-02-15 15:25:50 -06:00
Slava Pestov
18f4500bc6 Merge pull request #22611 from pschuh/s-4
IntegerLiteralExpr now is lowered directly into SIL.
2019-02-14 21:05:15 -05:00
Brent Royal-Gordon
31aeb64efa Make a .def file for ObjCSelectorFamily 2019-02-14 13:31:16 -08:00
Parker Schuh
b12fcb50db IntegerLiteralExpr now is lowered directly into SIL.
For context, String, Nil, and Bool already behave this way.

Note: Before it used to construct (call, ... (integer_literal)), and the
call would be made explicit / implicit based on if you did eg: Int(3) or
just 3. This however did not translate to the new world so this PR adds
a IsExplicitConversion bit to NumberLiteralExpr. Some side results of
all this are that some warnings changed a little and some instructions are
emitted in a different order.
2019-02-14 11:54:16 -08:00
Slava Pestov
2c015164cf Stop passing NodePointer by reference 2019-02-13 21:51:28 -05:00
Brent Royal-Gordon
5f94043ef6 [NFC] Move selector family logic to ObjCSelector
SILFunctionType has some logic which examines a selector and decides if it belongs to one of Objective-C’s special “method families”, like -alloc* and -copy*, which need to return a retained pointer instead of an autoreleased one. This change extracts most of that logic into SwiftAST as ObjCSelector::getSelectorFamily(), while leaving details specific to SIL’s use of it behind.
2019-02-13 18:40:25 -08:00
Slava Pestov
d0c7b1547e ASTMangler: Mangle sugared types for the debugger
Fixes <rdar://problem/48004306>.
2019-02-13 19:17:25 -05:00
Brent Royal-Gordon
3fb93cd05d Merge pull request #22198 from brentdax/im-on-the-case
Guard returns of limited-availability cases in init(rawValue:)
2019-02-12 16:28:06 -08:00
Robert Widmann
944d8d06d7 [SE-0155] Default Arguments in Enum Cases
The bulk of the changes are to SILGenApply.  As we must now evaluate the
payload ArgumentSource to an RValue, we follow the example of subscripts
and lie to the argument emitter.  This evaluates arguments at +1 which
can lead to slightly worse codegen at -Onone.
2019-02-12 10:06:48 -05:00
Slava Pestov
b64db715a8 IRGen: Remove -enable-class-resilience staging flag 2019-02-08 14:22:00 -05:00
Slava Pestov
5680bfde55 IRGen: Always use YAML files for completely fragile class layout
The layouts of resilient value types shipped in the Swift 5 standard library
x and overlays will forever be frozen in time for backward deployment to old
Objective-C runtimes. This PR ensures that even if the layouts of these types
evolve in the future, binaries built to run on the old runtime will continue
to lay out class instances in a manner compatible with Swift 5.

Fixes <rdar://problem/45646886>.
2019-02-08 14:22:00 -05:00
Slava Pestov
bb4cae06d0 IRGen: Rename -read-type-info-path flag to -read-legacy-type-info-path 2019-02-08 14:22:00 -05:00
Ding Ye
0f493a68b3 [Sema] Improve diagnostics for access level of protocol witness in extension. (#22235)
If the access level of a protocol witness does not satisfies a requirement,
the compiler suggests marking it as the required level.  This is not suitable
when the witness is in an extension whose specified access level is less than
the required level, since the fixit fights with other warnings in this case.
This patch identifies such case and produces improved diagnostics.

Resolves: SR-9793
2019-02-08 09:31:01 -08:00
Suyash Srijan
60da82b70d [GSB] [Diag] Constraint to concrete type using ":" should offer a fix-it (#22152)
* [diag] add a diagnostic note for the fixit

* [gsb] emit a diagnostic with fixit to replace ':' with '=='

* [gsb] rename variable

* [gsb] replace dyn_cast with isa

* [test] add a test case

* [test] update tests

* [gsb] emit diagnostic for protocols as well

* [gsb] simplify if statement

* [gsb] rename a variable

* [gsb] Create a helper to remove Self. prefix and add a new test case

* [gsb] simplify checks

* [gsb] move the diagnostic code to finalize()

* [gsb] re-indent

* [gsb] fix a typo

* [gsb] pass values as copy

* [gsb] show a fixit if the subject type is a member type

* [test] update diagnostics in existing tests

* [gsb] check if the subject type has an assoc type decl

* [gsb] use requirement source

* [test] add new tests

* [gsb] use constraint struct and rename to invalidIsaConstraints
2019-02-08 11:02:32 -05:00
Xi Ge
5617e4a793 AST: TapExpr should return sub-expression's source locations if set.
Without source location, TapExpr could stop IDE from collecting parameters
while perform refactoring.

rdar://47835267
2019-02-07 16:46:34 -08:00