Commit Graph

2125 Commits

Author SHA1 Message Date
Slava Pestov
6828a12416 Sema: Remove unnecessary circularity breaks 2019-10-03 17:11:45 -04:00
Rintaro Ishizaki
5914325a02 [SyntaxParse] Parse typealias declaration 2019-10-02 14:24:33 -07:00
Rintaro Ishizaki
7b31d2b4fb [SyntaxParse] Finish type parsing
- Type attributes
- SIL types
2019-10-01 15:40:10 -07:00
Suyash Srijan
ad4d623818 Merge pull request #27382 from theblixguy/fix/SR-11522
[CSApply] Don't diagnose a 'static let none' as ambiguous none unless its an enum type
2019-09-28 11:14:52 +01:00
Suyash Srijan
b3d7962598 [Test] Add some more tests around edge cases 2019-09-28 00:09:52 +01:00
Suyash Srijan
389232ac86 [Test] Add a FIXME next to a test case that should be diagnosed 2019-09-27 02:23:42 +01:00
Suyash Srijan
aa565f550c [CSApply] Compare variable's type with the base type of the enum we're assigning to 2019-09-26 20:49:25 +01:00
Suyash Srijan
25e1bb5ac1 [CSApply] Filter out functions and instance members before the ambiguous none check 2019-09-26 20:10:50 +01:00
Robert Widmann
233f8645d1 Move some more common enum diagnostics into the decl checker
In preparation for checkEnumRawValues being turned into a request, move the common diagnostics to the decl checker so they're always emitted at the right time.
2019-09-26 11:07:03 -07:00
Suyash Srijan
8d869e6f23 [CSApply] Don't diagnose a 'static let none' as ambiguous none unless its type matches the enum 2019-09-26 19:02:37 +01:00
Pavel Yaskevich
10b1baebb2 Merge pull request #27362 from xedin/port-missing-args
[Diagnostics] Port missing argument(s) diagnostics
2019-09-25 21:08:54 -07:00
Robert Widmann
c5a27efe56 Merge pull request #27351 from CodaFi/not-a-good-start-boris
Requestify Operator Precedence Groups and Precedence Group Lookup
2019-09-25 13:30:18 -07:00
Pavel Yaskevich
ec6a874ac8 [TypeChecker] NFC: Update test-cases improved by new missing arguments diagnostic 2019-09-25 10:47:26 -07:00
Robert Widmann
d992ff367b Requestify Operator Validation
Restructure the way operators and precedencegroup declarations are validated.  First, factor out the common operator validation code into the DeclChecker.  Then, redo the lookup and validation code for precedence groups to work with the request model.  Finally, delete the validateDecl overloads on the TypeChecker.

Unfortunately, the evaluator is not capable of detecting all the cycles TypeCheckDecl can.  In particular, certain cross-file precedence group cycles cannot be diagnosed via  request alone.  That infrastructure all stays in place.
2019-09-25 09:55:05 -07:00
Doug Gregor
9b20012ee1 Merge pull request #27322 from DougGregor/property-wrapper-composition-di
[DI] Support definite initialization for composed property wrappers.
2019-09-24 21:22:43 -07:00
Slava Pestov
0ade7b70d9 AST: Type::subst() preserves TypeAliasType sugar
Fixes <rdar://problem/45313760>.
2019-09-24 17:42:15 -04:00
Slava Pestov
fffe5c9d75 AST: Tweak computation of TypeAliasType recursive properties
The recursive properties now include the type alias generic parameters
and parent type, not just the underlying type. This means that a type
alias type like Foo<T>.Bar can be dependent even if its underlying type
is not dependent.
2019-09-24 17:39:53 -04:00
Doug Gregor
81c0a0ea93 [Property wrappers] Allow init(wrappedValue:) initializers with defaulted args
Generalize the type checking when searching for "wrappedValue"
initializers to also allow initializers that have other, defaulted
parameters as well.
2019-09-24 09:11:53 -07:00
Doug Gregor
5431efab71 Add fixed test case from rdar://problem/53349209 2019-09-24 09:11:53 -07:00
Robert Widmann
38bde33067 Merge pull request #27172 from CodaFi/aliasing-artifacts-and-noise-reduction-techniques
Kill validateDeclForNameLookup Harder
2019-09-18 15:00:51 -07:00
Slava Pestov
d3a4f3ded0 Sema: Diagnose captures of dynamic 'Self' type from default argument expressions
We could actually allow this for local functions, but it's not
worth implementing that until the more general ability of local
function default arguments to capture values is implemented.

Fixes <rdar://problem/55119566>.
2019-09-18 14:26:01 -04:00
Robert Widmann
4f6951c42f Change a cycle condition
Not having the generic signature is the real culprit here.
2019-09-18 11:24:03 -07:00
Holly Borla
29044e5d34 Merge pull request #27176 from hborla/type-cannot-conform-diag
[Diagnostics] Generalize the "protocol type cannot conform" error to work for all types that cannot conform to protocols.
2019-09-18 10:38:00 -07:00
Suyash Srijan
7814fdb899 Merge pull request #27226 from theblixguy/fix/SR-11381
[PropertyWrappers] Fix a bug with property type being overwritten with wrong type
2019-09-18 10:53:49 +01:00
Suyash Srijan
b3d3ef3867 [Test] Adds a test case 2019-09-18 01:58:24 +01:00
Suyash Srijan
c99facb48b Merge pull request #27057 from theblixguy/unrevert/SR-11298
Unrevert "[Sema] Setter has incorrect mutating-ness inside class-constrained protocol extension"
2019-09-18 01:15:07 +01:00
Holly Borla
bf80250c84 Merge remote-tracking branch 'upstream/master' into type-cannot-conform-diag 2019-09-17 11:54:03 -07:00
Holly Borla
7687293b7b [Diagnostics] Adjust the description of existential types for the
type_cannot_conform diagnostic message.
2019-09-17 11:52:43 -07:00
Holly Borla
2a7e0099d2 [Diagnostics] Add notes for the type_cannot_conform error that point
to the declaration that requires protocol conformance.
2019-09-17 09:22:07 -07:00
Hamish Knight
58459e7439 [CS] Allow simplification of key path subscript arg locators (#27194)
[CS] Allow simplification of key path subscript arg locators
2019-09-17 14:28:59 +01:00
Suyash Srijan
0bd7621a6b Merge pull request #27198 from theblixguy/fix/SR-11478
[PropertyWrapper] Fix a bug with static property wrapper being rejected in a class
2019-09-17 10:10:04 +01:00
Suyash Srijan
7ff3fd1f66 [Test] Adds some tests 2019-09-17 00:51:54 +01:00
Robert Widmann
e0a41b19cb Break some cycles
Computing the generic signature changes the way that cycles appear in the compiler.  For now, break these cycles.  We should investigate each place where hasComputedGenericSignature() is used in service of breaking cycles.  See rdar://55263708
2019-09-16 12:50:24 -07:00
Hamish Knight
176969ddde [CS] Allow simplification of key path subscript arg locators
This allows a few fixes to properly emit
diagnostics for key path subscript argument
contextual failures.

Resolves SR-11476.
2019-09-15 21:39:32 +01:00
Pavel Yaskevich
88c39db0c3 [Diagnostics] NFC: Fix improved test-cases related to argument-to-parameter mismatches 2019-09-13 22:35:53 -07:00
Pavel Yaskevich
001f46231c [Diagnostics] Fix a typo in argument mismatch diagnostic note 2019-09-13 22:35:52 -07:00
Pavel Yaskevich
a1643d94f7 [Diagnostics] NFC: Update all of the improved test-cases 2019-09-13 22:35:52 -07:00
Holly Borla
40985b6eb7 [Diagnostics] Generalize the "protocol type cannot conform" error to
work for all types that cannot conform to protocols.
2019-09-13 14:51:17 -07:00
Robert Widmann
2c5c4935f2 Merge pull request #27114 from CodaFi/formal-verification
[Gardening] Remove unnecessary options and files from tests
2019-09-10 22:26:12 -07:00
Robert Widmann
dce1e2ea32 [Gardening] Remove unnecessary options and files from tests 2019-09-10 18:15:16 -07:00
swift-ci
6663800cdc Merge pull request #27109 from DougGregor/sr-11393 2019-09-10 18:03:23 -07:00
Doug Gregor
9ce12ac422 [Type checker] Compute "mutating" for projected variables of wrapped properties
Extend the recently-refactored logic for determining whether the
getter/setter for a wrapped property is "mutating" to also consider
the projection variables (e.g., $foo). Fixes SR-11393 /
rdar://problem/54839570.
2019-09-10 16:38:12 -07:00
Robert Widmann
d4bb9a5cfe Define GenericParamListRequest
GenericParamListRequest formalizes the lazy generic parameter list construction pattern we were performing before.
2019-09-06 17:22:30 -07:00
Suyash Srijan
54a4615e6f [Diagnostics] Do not offer a mutating fix-it if we have a mutating protocol requirement
Do not offer a mutating fix-it if we have a mutating protocol requirement and we're assigning to it from an implicitly nonmutating setter inside a protocol extension
2019-09-06 23:40:07 +01:00
Varun Gandhi
c07023eab1 Merge pull request #27008 from varungandhi-apple/vg-fix-extended-type-crash
Fix module merging crash due to wrongly computed extended nominal type.
2019-09-06 11:35:53 -07:00
Suyash Srijan
0c0a72677c Merge branch 'master' into unrevert/SR-11298 2019-09-06 19:32:03 +01:00
swift-ci
eac416690f Merge pull request #27054 from CodaFi/extensional-angst 2019-09-06 11:15:54 -07:00
Suyash Srijan
fc6a49e834 [Test] Update tests 2019-09-06 18:37:11 +01:00
Robert Widmann
12b157e2bc Restore two tests
Address review feedback on #26970
2019-09-06 09:57:18 -07:00
Suyash Srijan
5cbfeb7b83 Merge pull request #27026 from theblixguy/fix/SR--11412
[CSDiagnostics] Offer protocol conformance fix-it in ContextualFailure
2019-09-06 00:44:38 +01:00