Commit Graph

12650 Commits

Author SHA1 Message Date
David Ungar
c7a6f8008f Clean up 2019-05-28 10:55:34 -07:00
David Ungar
663760e3b7 ASTOOScope ontology 2019-05-28 10:48:22 -07:00
Arnold Schwaighofer
4cb6c71adf Merge pull request #25064 from aschwaighofer/local_functions_not_implicit_dynamic
Don't add implicit dynamic to local functions.
2019-05-28 06:59:21 -07:00
Arnold Schwaighofer
0ebdce93e7 Don't add implicit dynamic to local functions. 2019-05-25 14:39:25 -07:00
Pavel Yaskevich
b47215db2f Merge pull request #25016 from xedin/refactor-fix-reqs
[ConstraintSystem] NFC: Unify logic used to fix requirement failures
2019-05-23 12:37:03 -07:00
Slava Pestov
3d4541d251 Merge pull request #25009 from slavapestov/type-checked-constants
ClangImporter: Build type-checked AST for constants
2019-05-23 13:52:07 -04:00
Pavel Yaskevich
b9d360cf73 [ConstraintSystem] NFC: Unify logic used to fix requirement failures
There was duplicate code used in `simplifyConformsToConstraint` and
`repairFailures`, both places should be using `fixRequirementFailure`
instead.
2019-05-23 10:24:04 -07:00
Slava Pestov
2cfc459e1e Sema: Build fully type-checked AST for dynamic member lookups 2019-05-23 10:40:34 -04:00
Slava Pestov
140a5b0018 Sema: Build fully type-checked AST for stub initializers 2019-05-23 10:40:34 -04:00
Arnold Schwaighofer
b3363af9c1 Don't use implicit dynamic on declarations if they are transparent or inlinable,
or have the silgen_name attribute

The first two are contratictory and the last is a current implementation
limitation.

rdar://51031462
2019-05-23 07:09:48 -07:00
Pavel Yaskevich
fc0ab61888 Merge pull request #24937 from xedin/rdar-50909555
[Diagnostics] Add known member declaration to `invalid member ref` di…
2019-05-21 16:34:38 -07:00
Doug Gregor
af7b461db2 Merge pull request #24959 from DougGregor/non-objc-dynamic-everywhere
Allow non-@objc ‘dynamic’ in all language modes.
2019-05-21 15:05:52 -07:00
Doug Gregor
19cc42bdee Merge pull request #24913 from DougGregor/property-delegates-generic-delegate-value-crash
[Property delegates] Fix crash involving generic uses of delegateValue.
2019-05-21 14:57:30 -07:00
Doug Gregor
22c0995046 Allow non-@objc ‘dynamic’ in all language modes.
Non-‘@objc’ ‘dynamic’ has been allowed since Swift 5, but there’s no
reason to tie it to the language mode (Swift >= 5).

Fixes rdar://problem/50348013.
2019-05-21 13:40:04 -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
7511e0a4d0 Merge pull request #24926 from xedin/rdar-50668864
[CSDiag] Adjust assert to account for changes in `filterContextualMem…
2019-05-20 16:30:59 -07:00
Pavel Yaskevich
464761e770 Merge pull request #24924 from xedin/rdar-50679161
[Diagnostics] Fix incorrect metatype check which leads to crashes
2019-05-20 16:30:12 -07:00
David Ungar
71228603b3 Remove dead code. 2019-05-20 14:53:35 -07:00
Pavel Yaskevich
31d001cc67 [CSDiag] Adjust assert to account for changes in filterContextualMemberList.
Originally `filterContextualMemberList` would only return a limited
set of closeness kinds `CC_GeneralMismatch`, `CC_Argument{Label, Count}Mismatch`,
and unavailable/inaccessible. At some point later it also started
matching almost everything besides `CC_SelfMismatch` and logic in
`visitUnresolvedMemberExpr` needs to get adjusted to account for that.

Resolves: rdar://problem/50668864
2019-05-20 13:39:39 -07:00
Pavel Yaskevich
ce61dfeadf [Diagnostics] NFC: Couple of small cleanups for invalid member ref 2019-05-20 13:22:33 -07:00
David Ungar
9681c3b0c8 Add isDecl check. 2019-05-20 13:04:30 -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
Jordan Rose
e0658a3726 Merge pull request #24774 from theblixguy/fix/duplicate-tuple-labels
[Typechecker] Ban tuples with duplicate labels
2019-05-20 11:28:46 -07:00
Doug Gregor
d86907e095 [Property delegates] Fix crash involving generic uses of delegateValue.
Fixes rdar://problem/50873275.
2019-05-20 10:15:12 -07:00
Brent Royal-Gordon
91146d5293 Merge pull request #24881 from brentdax/crouching-module-hidden-method
Allow inheritance from resilient classes with missing members
2019-05-19 15:47:11 -07:00
Slava Pestov
73f1b10dab Sema: Remove useBridgedNSErrorConformances()
The walker in SILGenLazyConformance.cpp should be sufficient to catch
any conformances needed at runtime, and after all the recent changes
SILGen is now able to trigger lazy conformance checking and synthesis
of fully-checked function bodies for accessors, which is enough to
remove the explicit conformance checks from Sema in this case.
2019-05-18 11:35:05 -04:00
Brent Royal-Gordon
9117c5728a Allow inheritance from resilient classes with missing members
When a class has missing vtable entries, we don’t allow it to be subclassed. This is unnecessarily restrictive for resilient classes, and @_implementationOnly imports now make missing vtable entries much more common. This commit carves out an exception to that rule for resilient classes.

Fixes <rdar://problem/50902125>.
2019-05-17 20:05:19 -07:00
Suyash Srijan
9ae2c85991 [Typechecker] Use CallArgs for checking duplicate label & add new test cases 2019-05-17 23:38:34 +01:00
Pavel Yaskevich
e76ae9c343 [ConstraintSystem] Use missing protocol fix for sequence element mismatches related to protocols 2019-05-17 14:32:04 -07:00
Pavel Yaskevich
17643a30e0 [ConstraintSystem] Move missing contextual protocol detection to matchExistentialTypes 2019-05-17 12:53:27 -07:00
Pavel Yaskevich
ada6ab599a [ConstraintSystem] Use missing conformance fix to diagnose contextual failures
Extend use of `missing protocol conformance` fix to cover contextual
failures, such as:

- Assignment mismatches, where destination requires source to conform
  to certain protocol (or protocol composition);
- Incorrect returns where returned type doesn't conform to the
  protocol specified in the signature.
2019-05-17 12:53:22 -07:00
Pavel Yaskevich
ace86e81cf [ConstraintSystem] Switch "missing conformance" fix/diagnostic to use protocol type
Switch type allows "missing conformance" diagnostic to be
used not only for protocols by for protocol compositions as well.
2019-05-17 12:52:15 -07:00
Pavel Yaskevich
d4e8d583ae Revert "[ConstraintSystem] Use missing conformance fix to diagnose contextual failures" 2019-05-17 12:45:55 -07:00
Pavel Yaskevich
5fb3a8ba30 Merge pull request #24754 from xedin/diag-missing-contextual-conformances
[ConstraintSystem] Use `missing conformance` fix to diagnose contextual failures
2019-05-17 11:40:49 -07:00
Suyash Srijan
92d41ef166 [Typechecker] Fix a crash 2019-05-17 00:57:40 +01:00
Suyash Srijan
b2c86709b1 [Typechecker] Check for CallExpr only, not ApplyExpr. Also, check for EnumElementDecl separately 2019-05-17 00:52:43 +01:00
Suyash Srijan
90d96881bb [Typechecker] Do not check tuple labels for a function call
It's okay to have two function parameters with the same external label, as long as the internal labels are different. If not, we already emit a diagnostic for it, so no need to check
2019-05-17 00:13:42 +01:00
Pavel Yaskevich
a20188bb27 Merge pull request #24826 from hamishknight/who-ya-gonna-callee
[CS] Consolidate logic forming locators to callees
2019-05-16 15:10:58 -07:00
Jordan Rose
3b4bb1960d @_implementationOnly: fix over-eager checking for vars in extensions (#24629)
The logic I had here checked whether an extension used an
implementation-only type whenever there was a declaration within that
extension that needed checking...but unfortunately that included not
just PatternBindingDecls (whose access is filtered at a later step)
but things like IfConfigDecls (#if). Change this to only check
signatures of extensions with ABI-public members, something that is
tested once when visiting an ExtensionDecl.

Additionally, skip AccessorDecls entirely, since they'll be tested
as part of the corresponding subscript or var. This saves a duplicate
diagnostic.

rdar://problem/50541589
2019-05-16 13:13:48 -07:00
Jordan Rose
9647483aee Warn when using '@_implementationOnly' inconsistently in a module (#24800)
I thought it would be useful to allow some uses of a module to be
'@_implementationOnly' and others to not be in case someone wanted to
change from one to the other gradually, but it turns out that if
you're trying to /make/ an import implementation-only, you want to
know everywhere you used it.

rdar://problem/50748157
2019-05-16 09:13:34 -07:00
Joe Groff
d22a405e38 Merge pull request #24822 from jckarter/opaque-type-runtime-weak-link
IRGen: Weak-link opaque type entry points.
2019-05-16 07:06:36 -07:00
Hamish Knight
f4c0bc748a [Sema] Fix compiler crasher SR-10696 2019-05-16 12:07:42 +01:00
Hamish Knight
8aa7401ba5 [Sema] Add getDeclOrNull to OverloadChoice
This helps clean up a bunch of call sites.
2019-05-16 12:07:41 +01:00
Hamish Knight
63df26a498 [CS] Use callee locators for fix ambiguities
Currently we check that the fixes share the same anchor, however this
doesn't account for the case where, given an ApplyExpr, one fix is
anchored on its function expr, and another is anchored on the apply
itself (because the former fix might be looking at the callee's
requirements, and the latter fix might be looking at an argument of
the call).

This commit changes the logic such that we check that fixes share the
same callee locator, which covers the above case. In addition, now
that we have the callee locator, we can use this to find the overload
directly.
2019-05-16 12:07:41 +01:00
Hamish Knight
894a1e50bf [CS] Consolidate logic forming locators to callees
This commit adds `ConstraintSystem::getCalleeLocator`, which forms a
locator that describes the callee of a given expression. This function
is then used to replace various places where this logic is duplicated.

This commit also changes the conditions under which a ConstructorMember
callee locator is formed. Previously it was formed for a CallExpr with a
TypeExpr function expr. However, now such a locator is formed if the
function expr is of AnyMetatypeType. This allows it to be more lenient
with invalid code, as well as work with DotSelfExpr.

Resolves SR-10694.
2019-05-16 12:07:40 +01:00
Pavel Yaskevich
30be693913 Merge pull request #24808 from xedin/cleaner-foreach
[TypeChecker] Simplify for ... in ... type checking
2019-05-16 00:16:46 -07:00
Joe Groff
2ade303387 IRGen: Weak-link opaque type entry points.
When backward deploying to an OS that may not have these entry points, weak-link them so that they
can be used conditionally in availability contexts that check for them.

rdar://problem/50731151
2019-05-15 20:40:54 -07:00
Joe Groff
0be95f56bd Merge pull request #24798 from jckarter/opaque-type-check-availability
Opaque types require a newer Swift runtime.
2019-05-15 18:05:40 -07:00
swift-ci
21b47fbd34 Merge pull request #24814 from DougGregor/property-delegate-bad-init-assertion 2019-05-15 17:57:01 -07:00