Commit Graph

24822 Commits

Author SHA1 Message Date
David Ungar
87799339c7 Eagerly expand function bodies before type-checking them, which scrambles them. 2019-11-06 10:36:14 -08:00
swift-ci
daa3b7ce7f Merge remote-tracking branch 'origin/master' into master-next 2019-11-06 08:49:32 -08:00
Ben Langmuir
63ef99e20c Merge pull request #28014 from rintaro/ide-completion-secondpass-rdar56819166
[CodeCompleiton] Avoid walking the whole module to find the delayed func
2019-11-06 08:34:15 -08:00
swift-ci
3a97d96bfb Merge remote-tracking branch 'origin/master' into master-next 2019-11-06 00:49:28 -08:00
David Ungar
069db6e661 Merge pull request #28038 from davidungar/rdar-56760957-dont-do-ide-lookups-into-inactive-clauses
[SourceKit NameLookup] Don't walk into inactive clauses.
2019-11-06 00:40:20 -08:00
swift-ci
72362c9c8d Merge remote-tracking branch 'origin/master' into master-next 2019-11-06 00:29:57 -08:00
Pavel Yaskevich
6d02fb7815 Merge pull request #28057 from xedin/assign-diags
[Diagnostics] Port the rest of assignment diagnostics to the new framework
2019-11-06 00:11:08 -08:00
swift-ci
ecedea9231 Merge remote-tracking branch 'origin/master' into master-next 2019-11-05 22:29:55 -08:00
Robert Widmann
e907d3bc52 [NFC] Remove the TypeChecker from Typo Correction 2019-11-05 20:29:36 -08:00
swift-ci
ad3ea35608 Merge remote-tracking branch 'origin/master' into master-next 2019-11-05 20:10:09 -08:00
Robert Widmann
06378aebcd Merge pull request #28092 from CodaFi/typing-of-the-dead
Kill the LazyResolver
2019-11-05 19:54:39 -08:00
swift-ci
a92177ae25 Merge remote-tracking branch 'origin/master' into master-next 2019-11-05 17:49:35 -08:00
Hamish Knight
10d62a1e4e [CSDiagnostics] Allow non-ephemeral diag to refer to argument… (#28084)
[CSDiagnostics] Allow non-ephemeral diag to refer to argument labels
2019-11-05 17:43:39 -08:00
Suyash Srijan
3ecc13b360 Merge pull request #28015 from nexon/SR-11679-incorrect-fix-suggestion-cftypes
SR-11679: Incorrect FixIt suggestion for CFTypes
2019-11-06 01:32:55 +00:00
Michael Gottesman
fe257d58a7 [semantics] Add support for annotating VarDecls with @_semantics.
This is just for prototyping purposes. I also had to loosen a small restriction
where semantics functions were not allowed in local contexts. There really is no
reason to enforce this and I think since it came in the first commit that
introduced semanitcs it was most likely NadavR just being conservative and
careful.
2019-11-05 17:31:58 -08:00
swift-ci
cc8f59a38e Merge remote-tracking branch 'origin/master' into master-next 2019-11-05 15:50:04 -08:00
Joe Groff
0fc8377159 Merge pull request #28065 from apple/subst-function-type-value-lowering
SIL: Type lowering for function values with substituted SIL function types.
2019-11-05 15:36:37 -08:00
Robert Widmann
2b08d1b834 [NFC] ASTContext::getLazyResolver -> ASTContext::getLegacyGlobalTypeChecker 2019-11-05 14:44:41 -08:00
Robert Widmann
56a713f179 Remove LazyResolver! 2019-11-05 14:43:12 -08:00
Hamish Knight
96e5f2a145 Allow non-ephemeral diag to refer to argument labels
Use getArgDescription to improve the diagnostic
for invalid temporary pointer conversions.
2019-11-05 13:51:53 -08:00
swift-ci
d32b83a987 Merge remote-tracking branch 'origin/master' into master-next 2019-11-05 13:39:10 -08:00
Ben Langmuir
3c714bc525 Merge remote-tracking branch 'origin/master' into master-next 2019-11-05 13:32:25 -08:00
Robert Widmann
01d272073a Requestify Witness Resolution
Witness matching is a source of a lot of ad-hoc cycles, and mixes the
logic that performs resolution, caching, validation, and cycle detection into one
place.  To make matters worse, some checkers kick off other checks in
order to cache work for further declarations, and access an internal
cache on their subject conformance for many requirements at once, or
sometimes just one requirement.

None of this fits into the request evaluator's central view of the
caching.  This is further evidenced by the fact that if you attempt to
move the caching step into the evaluator, it overcaches the same
witness and trips asserts.

As a start, define requests for the resolution steps, and flush some
hacks around forcing witness resolution. The caching logic is mostly
untouched (the requests don't actually cache anything), but some cycle
breaking is now handled in the evaluator itself.  Once witness matching
has been refactored to cache with the evaluator, all of these hacks can
go away.

My urge to destroy the LazyResolver outweighs the compromises here.
2019-11-05 13:28:07 -08:00
Robert Widmann
0e1766e1cc Merge pull request #28068 from CodaFi/welcome-to-the-salty-spitoon
Rationalize Implicit Member Synthesis Somewhat
2019-11-05 13:05:55 -08:00
Joe Groff
27d7117f9f SIL: Type lowering for function values with substituted SIL function types.
After converting a function type to its corresponding SIL type by our usual rules, extract
the substituted generic signature and common interface type for all concrete function types
that the function could be called as. We don't currently have any use cases for distinguishing
types at finer granularity than generic class-constrained/generic unconstrained/not-generic, so
to reduce the amount of conversion noise in SIL, generate the most general generic signature
possible, by extracting every position with a dependent generic parameter or associated type thereof
into a separate generic parameter in the substituted signature, discarding all constraints except
for `AnyObject` layout constraints. This way, if `foo<T>(x: (T, T) -> ())` calls
`bar<T, U>(x: (T, U) -> ())` and forwards `x` along, the two closures that only vary in genericity
don't need a conversion even with substituted function types, because they'll both have the same
abstract lowering `<A, B> (A, B) -> ()` with different substitutions.
2019-11-05 12:48:11 -08:00
Pavel Yaskevich
30440d8235 [Diagnostics] Properly diagnose assignment mismatch in ambiguity cases 2019-11-05 12:38:13 -08:00
David Ungar
0838a6646d Provide hook to see if ASTScopes support lookups into inactive clauses 2019-11-05 12:10:43 -08:00
Joe Groff
4d6392b8ad Add an option to stage in substituted type lowering for function values 2019-11-05 11:32:34 -08:00
Holly Borla
e63f259f4f [ConstraintSystem] Bind holes to UnresolvedType instead of Any. 2019-11-05 09:15:13 -08:00
Robert Widmann
d4906ac10b Rationalize Implicit Member Synthesis Somewhat
Codable's deep magic currently forces conformance checks in the middle
of name lookup in order to inject CodingKeys into lookup results.  This
is compounded by the fact that this lookup fixup is occuring
incrementally, meaning depending on order of requirements being looked
up, Decl::getMembers() will give you a different answer.

Compounding this, NameLookup relied on the LazyResolver to formalize
this layering violation, and relied on implicit laziness to guard
against re-entrancy.

The approach is multi-pronged:
1) Shift the layering violation into the request evaluator
2) Spell out the kinds of resolution we support explicitly (make them
easier to find and kill)
3) Remove the LazyResolver entrypoint this was relying on
4) Split off the property wrappers part into its own utility
2019-11-05 09:10:13 -08:00
swift-ci
b6cfc01dc4 Merge remote-tracking branch 'origin/master' into master-next 2019-11-04 23:49:31 -08:00
marcrasi
ce756e3189 [AutoDiff upstream] parsing for @differentiable function type (#27708)
Adds parsing for a type attribute `@differentiable`, which is optionally allowed to have argument `@differentiable(linear)`.

The typechecker currently rejects all uses of `@differentiable` with "error: attribute does not apply to type". Future work (https://bugs.swift.org/browse/TF-871 https://bugs.swift.org/browse/TF-873) will update the typechecker to allow this attribute in places where it is allowed.

Resolves https://bugs.swift.org/browse/TF-822.
2019-11-04 23:40:04 -08:00
swift-ci
92b412acca Merge remote-tracking branch 'origin/master' into master-next 2019-11-04 22:50:02 -08:00
Holly Borla
d91e4747ac Merge pull request #28073 from hborla/nil-conditional-cast
[CSGen] Add a tailored diagnostic for conditional casting from a nil literal.
2019-11-04 22:33:23 -08:00
Holly Borla
b1638ce1ab [CSGen] Add a tailored diagnostic for conditional casting from a nil literal,
and diagnose in CSGen.
2019-11-04 20:49:36 -08:00
swift-ci
afe71a79f3 Merge remote-tracking branch 'origin/master' into master-next 2019-11-04 17:49:58 -08:00
Saleem Abdulrasool
8484aed9c0 Merge pull request #28064 from compnerd/isa-accessor
SIL: silence `-Wunused-variable` (NFC)
2019-11-04 17:41:27 -08:00
swift-ci
5f9e32b974 Merge remote-tracking branch 'origin/master' into master-next 2019-11-04 17:30:26 -08:00
Hamish Knight
40231991ae [Sema] Diagnose unsound pointer conversions (#27695)
[Sema] Diagnose unsound pointer conversions
2019-11-04 17:18:57 -08:00
Saleem Abdulrasool
32151c6463 SIL: silence -Wunused-variable (NFC) 2019-11-04 15:07:30 -08:00
swift-ci
9f6c8cbf3a Merge remote-tracking branch 'origin/master' into master-next 2019-11-04 12:50:07 -08:00
Robert Widmann
ce4b20c90d [Gardening] Remove dead LazyResolver members 2019-11-04 11:13:14 -08:00
swift-ci
f8b50e8fba Merge remote-tracking branch 'origin/master' into master-next 2019-11-03 19:49:24 -08:00
Robert Widmann
5076d71daf Merge pull request #28033 from RayZhao1998/master
[Diagnostics] Resolve SR-11677: Offer a better diagnostic when && is …
2019-11-03 19:33:52 -08:00
Hamish Knight
65dda6d945 Address other review feedback 2019-11-03 08:42:26 -08:00
Hamish Knight
998434f0da Add a -disable-invalid-ephemeralness-as-error flag
Currently this does nothing, as we're warning by
default, but once we error by default, this will
downgrade the diagnostic to a warning.
2019-11-03 08:42:26 -08:00
Hamish Knight
8cccbe0118 [Sema] Infer @_nonEphemeral for various parameters
These include memberwise initializers for pointer properties and enum
case constructors for pointer payloads. In both cases, the pointer is
being immediately escaped, so don't allow the user to pass a temporary
pointer value.
2019-11-03 08:42:26 -08:00
Hamish Knight
d0dbbf9f89 [CSDiagnostics] Add ephemeralness ambiguity notes 2019-11-03 08:42:25 -08:00
Hamish Knight
7077a68b83 [Sema] Diagnose unsound pointer conversions
Diagnose ephemeral conversions that are passed to @_nonEphemeral
parameters. Currently, this defaults to a warning with a frontend flag
to upgrade to an error. Hopefully this will become an error by default
in a future language version.
2019-11-03 08:42:25 -08:00
Hamish Knight
92c42ec791 [AST] Add @_nonEphemeral parameter attribute
This non-user-facing attribute is used to denote pointer parameters
which do not accept pointers produced from temporary pointer conversions
such as array-to-pointer, string-to-pointer, and in some cases
inout-to-pointer.
2019-11-03 08:40:59 -08:00