Commit Graph

12650 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
Slava Pestov
6d19f7e0f4 Sema: Fix inconsistent behavior with SE-0110-related compatibility hack
Back when SE-0110 was implemented we decided that passing a function value
taking multiple parameters would be allowed where a function value taking
a single tuple argument was expected.

Due to quirks in the old function type representation, the "splat" in the
other direction sometimes worked too. When we redid the function type
representation we added a simulation of the old quirk for -swift-version 4
mode.

However this simulation was itself problematic because it only worked when
the function value being passed was a non-overloaded declaration reference.

Slightly broaden the hack to the overloaded case, to prevent user
confusion when adding or removing overloads.
2019-02-21 09:57:03 -05:00
Joe Groff
d032a9a539 Merge pull request #22758 from jckarter/opened-archetype-generic-environment
Generic environments for opened archetypes
2019-02-20 16:19:48 -08:00
Pavel Yaskevich
af43ae7f0a Merge pull request #22759 from xedin/fix-loc-with-explict-init-ref
[CSDiagnostics] Use correct overload locator when requirement belongs…
2019-02-20 15:39:39 -08:00
Pavel Yaskevich
ff2510816d [CSDiagnostics] Use correct overload locator when requirement belongs to explicit init ref
Previously the logic to determine path to the selected overload
in such case was simplistic and only checked the name to be
of constructor, but `ConstructorMember` path is formed only if
member reference is a constructor delegation e.g. `self.init` or
`super.init` in an initializer context.
2019-02-20 12:54:27 -08: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
Mishal Shah
345e9881d1 Merge pull request #22699 from apple/stable-update-5.1
Update Swift:master to work with new stable re-branch from swift-5.1-branch
2019-02-20 12:22:00 -08:00
Pavel Yaskevich
8d142ee191 Merge pull request #22719 from xedin/rdar-48114578
[CSApply] Account for failures in argument application of unresolved …
2019-02-20 00:34:56 -08:00
Slava Pestov
7ffa09557d AST: Introduce AvailabilityContext::forDeploymentTarget() 2019-02-19 18:57:30 -05:00
Pavel Yaskevich
875932b3bf [CSApply] Account for failures in argument application of unresolved member calls
While attempting to form a call of an unresolved member, the fact
that argument application could fail has to be accounted for.

Resolves: rdar://problem/48114578
2019-02-19 13:02:01 -08:00
David Zarzycki
3861c0e24a Merge pull request #22709 from davezarzycki/exhaustive_coerceToType
[Sema] NFC: Use exhaustive switches in coerceToType()
2019-02-19 12:58:46 -05:00
Arnold Schwaighofer
17e64f5e9c Merge pull request #22691 from aschwaighofer/allow_dynamic_replacement_init_non_delegating
Allow dynamic replacement initializers to be non delegating
2019-02-19 08:38:08 -08:00
David Zarzycki
9926baebd3 [Sema] NFC: Use exhaustive switches in coerceToType() 2019-02-19 10:08:51 -05:00
David Zarzycki
65a452f764 Merge pull request #22689 from davezarzycki/fix_overloaded_generics_crash
[Sema] NFC: fix assert-only crasher with overloaded generics
2019-02-19 08:21:43 -05:00
David Zarzycki
52aa2438aa Merge pull request #22681 from davezarzycki/coerceToType_switches
[Sema] NFC: refactor coerceToType() to use switch statments
2019-02-19 08:20:55 -05:00
Pavel Yaskevich
91fd42d2dd Merge pull request #22701 from xedin/rdar-47980354
[CSDiagnostics] Imporove requirement diagnostics originating in conte…
2019-02-19 00:55:53 -08: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
Pavel Yaskevich
a7c66ca476 [CSDiagnostics] Imporove requirement diagnostics originating in contextual type
Detect that failed requirement comes from contextual type and use
that information to determine affected declaration.

Resolves: rdar://problem/47980354
2019-02-18 17:58:28 -08:00
Pavel Yaskevich
ad802c3276 Merge pull request #22693 from xedin/opt-type-req-locators
[CSFix] Use fully qualified locators for requirement failures
2019-02-18 15:10:53 -08: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
Pavel Yaskevich
70b5bce791 [CSFix] Use fully qualified locators for requirement failures
Would help to diagnose failures where requirement comes from
contextual type, also simplifies logic around requirement fixes
to some degree.
2019-02-18 12:03:46 -08:00
Arnold Schwaighofer
8f0fbd2c75 Allow dynamic replacement initializers to be non delegating
rdar://48125765
2019-02-18 10:26:59 -08:00
David Zarzycki
51ef3c014a [Sema] NFC: fix assert-only crasher with overloaded generics 2019-02-18 08:49:42 -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
d7324b977e Added more tests
Testing SILGen & IRGen tuple keypath generation
Added tuple element type check in SILVerifier
2019-02-18 10:19:42 +01:00
Andrea Tomarelli
ede47cafbd Partial AST & Sema implementation of TKP 2019-02-18 09:04:42 +01:00
Bob Wilson
213efe089c Merge commit '06120c9d9d1a28275a0ecd7466775b1d71716be7' into stable-update-5.1 2019-02-17 10:20:59 -08:00
David Zarzycki
c037886c2b [Sema] NFC: refactor coerceToType() to use switch statments
The current series of "unrelated" `if` statements makes understanding
and updating this function harder than necessary. By using two `switch`
statements, we can avoid these problems and as a bonus, generate more
efficient code gen.
2019-02-17 12:49:21 -05: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
Pavel Yaskevich
b009bf6154 Merge pull request #22630 from xedin/add-generic-context-to-locator
[ConstraintLocator] Add generic signature to `OpenedGeneric` element
2019-02-15 17:36:19 -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
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
Stephen Canon
6159ba810d Remove the (unused) SIMDOperators module. (#22530)
We originally planned to use this to hide some simd operators from the typechecker unless the user explicitly opted into having them but that scheme turned out to be ill-conceived, so we moved them
back into the stdlib. This change simply cleans up the empty vestigial module.
2019-02-14 16:37:41 -08:00
Pavel Yaskevich
4f0f090e36 [CSDiagnostics] Use generic signature to retrieve failing requirement 2019-02-14 12:18:17 -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
Pavel Yaskevich
5f47862d7c [ConstraintLocator] Add generic signature to OpenedGeneric element
This information is useful for requirement diagnostics, because
generic signature represents the source of generic requirements.
2019-02-14 00:34:18 -08: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
Pavel Yaskevich
26a7d17f62 Merge pull request #22526 from xedin/rdar-47967277
[CSBindings] Preserve l-valueness of optional object type
2019-02-12 14:46:47 -08:00
Pavel Yaskevich
e840be0d25 Merge pull request #22559 from xedin/fix-accesors-on-fixes
[CSFix] NFC: Fixes should only be created via `create(...)`
2019-02-12 13:58:26 -08:00
Pavel Yaskevich
4a2e889853 [CSFix] NFC: Fixes should only be created via create(...)
This is a small access control cleanup where some of the
fixes had public constructors, which is not a preferred
way to create fixes, `create(...)` should be used instead.
2019-02-12 12:16:30 -08:00
Robert Widmann
4fa53c1ba9 Merge pull request #22488 from Azoy/remove-lookupBoolType
[Sema] Remove lookupBoolType
2019-02-12 12:21:01 -05:00
Pavel Yaskevich
8f884c45c4 [CSBindings] Preserve l-valueness of optional object type
Result of force unwrap is always connected to its base
optional type via `OptionalObject` constraint which
preserves l-valueness, so in case where object type got
inferred before optional type (because it got the
type from context e.g. parameter type of a function call),
we need to test type with and without l-value after
delaying bindings for as long as possible.

Resolves: rdar://problem/47967277
2019-02-11 21:28:16 -08:00
Pavel Yaskevich
34f320c6b3 Merge pull request #22518 from theblixguy/fix/dont-discard-me
[Typechecker] Fix an issue with @discardableResult error not being emitted
2019-02-11 17:16:34 -08:00
Pavel Yaskevich
75b5824bf9 Merge pull request #22480 from xedin/rdar-47871590
[ConstraintSystem] Diagnose conditional requirement failures via fixes
2019-02-11 14:58:08 -08:00
Suyash Srijan
e5e5d134f5 [Typechecker] Fix an issue with discardableResult error not being emitted 2019-02-11 21:57:16 +00:00
Jordan Rose
cc1800d63e Merge pull request #22460 from jrose-apple/i-cannot-contain-my-excitement
Extend transitive availability checking to initial value expressions (better version)
2019-02-11 11:12:19 -08:00
Suyash Srijan
4e56b54b94 [typechecker] [test] cleanup 2019-02-09 17:24:12 +00:00
Azoy
e9f4217f03 remove lookupBoolType
diagnose broken bool

fix
2019-02-09 00:13:51 -06:00
Suyash Srijan
7356f41881 [typechecker] allow non-optional enum case match with optional enum 2019-02-08 23:29:33 +00:00