Sam Lazarus
70bdcfd370
Sema: Add handling for fixes when member is present on $$ version of decl
2019-06-28 12:09:50 -07:00
Sam Lazarus
bd54febb37
Sema: Change property wrappers fixit to always remove the correct number of '$'
2019-06-28 12:09:50 -07:00
Sam Lazarus
6ec03da6b0
Sema: Add property wrapper diagnostic for unnecessary $ in member access
...
Additionally, refactor some of the logic for the original add $ diagnostic
so that a lot of logic can be shared between the two. Also rename the
original fix and diagnostic to better reflect their purpose.
2019-06-28 12:09:49 -07:00
Pavel Yaskevich
c118c383d8
[Diagnostics] Diagnose all invalid references to instance methods
...
Extend use of "instance member on type" fix to cover potentially
invalid partial applications, references to instance members on
metatypes, and remove related and now obsolete code from `CSDiag`.
Resolves: [SR-9415](https://bugs.swift.org/browse/SR-9415 )
2019-06-27 16:09:07 -07:00
Doug Gregor
446d0b3953
[SE-0258] Rename backing storage property to _foo.
...
In anticipation of upcoming changes to the property wrapper proposal,
rename the backing storage for a wrapped property to "foo", unconditionally.
2019-06-26 07:39:01 -07:00
Pavel Yaskevich
b72b3cbf0d
Merge pull request #25721 from theblixguy/fix/SR-10992
...
[ConstraintSystem] Fix crash on function conversion reliant on conditional conformance
2019-06-24 16:52:35 -07:00
Suyash Srijan
2e31ca6daf
[ConstraintSystem] Use getConstraintLocator directly
2019-06-24 22:35:34 +01:00
Suyash Srijan
aaacd29b68
[ConstraintSystem] Adds the new overload to FailureDiagnostic as well and remove other instances of 0 summary flags
2019-06-24 22:33:38 +01:00
Suyash Srijan
7a63586f34
[ConstraintSystem] Use the new getConstraintLocator overload
2019-06-24 21:58:23 +01:00
Pavel Yaskevich
ef96e8904f
Merge pull request #25638 from xedin/rdar-51576862
...
[Diagnostics] Don't suggest argument destructuring fix-it if closu…
2019-06-21 12:32:44 -07:00
Sam Lazarus
ebcbaca968
[Diagnostics] Add a diagnostic for inserting a $ to remove an extraneous property wrapper unwrap ( #25507 )
2019-06-20 20:28:25 -04:00
Pavel Yaskevich
ebe0e42461
[Diagnostics] Don't suggest argument destructuring fix-it if closure is malformed
...
If closure expression is malformed don't try to suggest a fix-it
about destructuring, because there is no way to figure out where
it would actually go in the source.
Resolves: rdar://problem/51576862
2019-06-20 12:35:26 -07:00
Jordan Rose
9e471e4124
Don't offer a fix-it to convert to a 'some' type ( #25619 )
...
There's no way to spell an opaque type in a cast, and that means
there's no way to force the conversion today (even if you know the
types are dynamically the same).
Part of rdar://problem/50346954
2019-06-19 19:17:32 -07:00
Pavel Yaskevich
379d88cb12
Merge pull request #25575 from xedin/rdar-51784793
...
[Diagnostics] Guard against missing parent initializer in missing unw…
2019-06-19 10:54:55 -07:00
Pavel Yaskevich
fca8106f95
[Diagnostics] Guard against missing parent initializer in missing unwrap diagnostic
...
While trying to diagnose missing optional unwrap for single use
vars guard against it not having a parent initializer.
Unfortunately there is no test-case for this but we have
received multiple reports about `offerDefaultValueUnwrapFixIt`
crashing trying to access locator on passed in `expr`.
Resolves: rdar://problem/51784793
2019-06-18 14:23:35 -07:00
swift-ci
a1b281135a
Merge pull request #25359 from hamishknight/five-minute-argument
2019-06-18 10:36:10 -07:00
Sam Lazarus
122a68c217
Sema: Change generic argument mismatch diags to reuse existing ones
2019-06-14 12:35:32 -04:00
Sam Lazarus
0a7cdb8ded
Sema: Handle CTP_SubscripAssignSource in GenericArgumentsMismatch::getDiagnosticFor
2019-06-14 12:35:32 -04:00
Sam Lazarus
de7851b0e9
Test: Update tests to reflect change to generic mismatch note locations
2019-06-14 12:35:32 -04:00
Sam Lazarus
1701ea1adc
Sema: Changed GenericArgumentsMismatch to use trailing objects
2019-06-14 12:35:31 -04:00
Sam Lazarus
81dc5460c9
Sema / Test: Fix tests broken by introduction of GenericArgumentsMismatchFailure
...
Additionally, fixed a crash caused by the change relating to opaque types.
2019-06-14 12:35:31 -04:00
Sam Lazarus
dc5ccd1349
Test: Add tests for the new generic arguments mismatch diagnostic
2019-06-14 12:35:31 -04:00
Sam Lazarus
7719b0f461
Sema: Add a more descriptive diagnostic for generic argument mismatches
2019-06-14 12:35:31 -04:00
Hamish Knight
e285916ab1
Simplify implementation of resolveInterfaceType a little
2019-06-13 21:58:44 +01:00
Hamish Knight
6c00d89a87
Assert when we expect to resolve a callee overload
...
This helps ensure we don't miss cases where `getChoiceFor` was meant to
return a callee overload but doesn't.
2019-06-13 13:51:51 +01:00
Hamish Knight
ebc2ff5bd5
Use getFunctionArgApplyInfo in missing-unwrap diagnostic
2019-06-13 13:51:50 +01:00
Hamish Knight
179c81d437
Use getFunctionArgApplyInfo in escaping diagnostics
...
This simplifies the implementation and fixes a compiler crasher.
Resolves SR-10811.
2019-06-13 13:51:49 +01:00
Hamish Knight
a84cdbc31e
Add FailureDiagnostic::getFunctionArgApplyInfo
...
This allows failure diagnostics to retrieve information about the
application of an argument to a parameter at their locator.
2019-06-13 13:51:49 +01:00
Hamish Knight
061ab18297
Add FailureDiagnostic::resolveInterfaceType
...
This allows a raw type to be resolved using generic parameters where
possible.
2019-06-13 13:51:49 +01:00
Doug Gregor
f2db4078a5
[Type checker] Collapse some duplicate code. Thanks, Pavel!
2019-06-11 17:34:44 -07:00
Doug Gregor
b634f594a0
[Function builders] Create a FailureDiagnostic for unhandled constructs.
2019-06-11 17:34:44 -07:00
Pavel Yaskevich
4bd5a1e4e1
[Diagnostics] Clarify requirement failure source when it's anchored at assignment
...
While trying to fetch owner type for generic requirement failures
anchored at assignment expression, use assignment source as an anchor
because that's where requirements come from - conversion from source
type to destination.
Resolves: rdar://problem/51587755
2019-06-11 11:59:46 -07:00
Pavel Yaskevich
6cdd981ee1
Merge pull request #25080 from owenv/improve_subscript_assignment_diag
...
[Diagnostics] Clarify diagnostic for failed type conversion in subscript assignment
2019-06-04 19:33:23 -07:00
Pavel Yaskevich
2f3809c5b3
Merge pull request #25149 from xedin/diag-missing-generic-args
...
[ConstraintSystem] Detect and diagnose missing generic arguments
2019-05-31 13:04:00 -07:00
Sam Lazarus
dc886ebe47
Sema: Move call to getRValueType inside of getBaseType
2019-05-30 19:07:25 -04:00
Sam Lazarus
147280ac3b
Sema: Renamed invalid member ref on existential fix, and refactored inheritance
2019-05-30 18:48:58 -04:00
Sam Lazarus
0714dfe607
Sema: Convert to rvalue type before diagnosing protocol type member failure
2019-05-30 18:35:20 -04:00
Pavel Yaskevich
da799ebe51
[Diagnostics] Add a note if missing parameter is associated with generic subscript
2019-05-30 14:43:37 -07:00
Pavel Yaskevich
5e35c3e445
[Diagnostics] Replace CSDiag logic for diagnosing missing generic arguments with new diagnostic
2019-05-30 12:38:17 -07:00
Pavel Yaskevich
d0a956098b
[Diagnostics] Move findArgumentLocations logic from fix to diagnostic
2019-05-30 11:27:20 -07:00
Sam Lazarus
6af91cc08d
Sema: Removed unnecessary ValueDecl from AllowProtocolTypeMember
...
Additionally removed the same unnecessary ValueDecl from
AllowProtocolTypeMemberFailure allowing it to extend MissingMemberFailure.
2019-05-30 01:03:46 -04:00
Sam Lazarus
049ec0f851
Sema: Port member access on existentials diagnostic to new diagnostic framework
2019-05-30 00:32:01 -04:00
Pavel Yaskevich
44536fe2e0
[Diagnostics] Improve missing generic argument diagnostic notes
...
Emit separate notes for generic parameters found in operator, initializer
and function declarations. As well as clarify types of `declared in type`
note.
2019-05-29 10:26:05 -07:00
Pavel Yaskevich
e97955e7c7
[Diagnostics] Add a new diagnostic for missing generic arguments
2019-05-29 10:26:04 -07:00
Owen Voorhees
8e1c00cb46
[Diagnostics] Clarify diagnostic for failed type conversion in subscript assignment
...
Addresses SR-6340
2019-05-28 18:58:41 -07:00
Pavel Yaskevich
866e8f51fa
[Diagnostics] Let invalid member ref carry member declaration instead of looking it up
...
All places where `invalid member ref` fix/diagnostic is used already
have a reference to the potential member choice declaration, which
diagnostic could take advantage of.
2019-05-21 11:49:03 -07:00
Pavel Yaskevich
48688241c3
[Diagnostics] Add known member declaration to invalid member ref diagnostic
...
This is useful for `CSDiag` when it detects that all
overload choices have the same problem. Since there
are going to be no solutions, choice declaration could
be supplied to `invalid ref` diagnostic directly.
Resolves: rdar://problem/50467583
Resolves: rdar://problem/50682022
Resolves: rdar://problem/50909555
2019-05-20 17:29:15 -07:00
Pavel Yaskevich
ce61dfeadf
[Diagnostics] NFC: Couple of small cleanups for invalid member ref
2019-05-20 13:22:33 -07:00
Pavel Yaskevich
1499811add
[Diagnostics] Fix incorrect metatype check which leads to crashes
...
Incorrect member reference diagnostic tailed for protocols
should cover existential metatypes as well.
rdar://problem/50679161
2019-05-20 12:52:53 -07:00
Pavel Yaskevich
e76ae9c343
[ConstraintSystem] Use missing protocol fix for sequence element mismatches related to protocols
2019-05-17 14:32:04 -07:00