Commit Graph

15871 Commits

Author SHA1 Message Date
swift-ci
f1fe0bbb2d Merge remote-tracking branch 'origin/master' into master-rebranch 2020-01-30 11:23:11 -08:00
Slava Pestov
4ef4cd69d2 Merge pull request #29544 from slavapestov/conditional-requirements-checking-screwup
Sema: Fix crash when property type references type alias with unsatisfied requirements
2020-01-30 11:06:07 -08:00
swift-ci
ca1a9c5356 Merge remote-tracking branch 'origin/master' into master-rebranch 2020-01-30 10:23:09 -08:00
Pavel Yaskevich
836d88f419 Merge pull request #29546 from LucianoPAlmeida/visit-try-expr
[CSDiag] Removing unused FailureDiagnosis::visitTryExpr
2020-01-30 10:21:51 -08:00
Pavel Yaskevich
6debe3d3b5 [ConstraintSystem] Don't produce conformance fixes for mismatches associated with function result type
If there are any requirement failures associated with result types
which are part of a function type conversion, let's record general
conversion mismatch in order for it to capture and display complete
function types.
2020-01-30 09:54:33 -08:00
Pavel Yaskevich
2d10a8a9a0 [ConstraintSystem] Extend function type conversion mismatch coverage
Originally type mismatches associated with conversions between
function types were only covered for coercions and assignments
but fix coverage grew since then and now it makes sense
to remove special case and let `repairFailures` take care of it.
2020-01-30 09:45:36 -08:00
Luciano Almeida
dcaa950f7b [CSDiag] Removing unused FailureDiagnosis::visitTryExpr 2020-01-30 12:28:32 -03:00
swift-ci
e8a2e780d7 Merge remote-tracking branch 'origin/master' into master-rebranch 2020-01-30 00:23:10 -08:00
Slava Pestov
f4a5301bfd Sema: Fix crash when property type references type alias with unsatisfied requirements
The fix for <https://bugs.swift.org/browse/SR-10466> did not handle
properties because those types are resolved using the archetype
resolver.

We would bail out early because of a bogus early return that can
just be removed.

Fixes <rdar://problem/45271663>.
2020-01-29 23:10:26 -08:00
Slava Pestov
9bd638579d Sema: Fix duplicate diagnostic spam with 'Self' in properties
Fixes <https://bugs.swift.org/browse/SR-11681> / <rdar://problem/56747659>.
2020-01-29 22:11:20 -08:00
swift-ci
822408fbc6 Merge remote-tracking branch 'origin/master' into master-rebranch 2020-01-29 14:23:11 -08:00
Slava Pestov
3c86061de8 Sema: Fix module interface printing of inherited generic initializers
Make sure we use the sugared form of GenericTypeParamType and not
the canonical type.

Fixes <rdar://problem/58578998>.
2020-01-29 12:32:22 -08:00
swift-ci
8c51bf5a86 Merge remote-tracking branch 'origin/master' into master-rebranch 2020-01-29 11:44:00 -08:00
Pavel Yaskevich
3fff5dd064 [ConstraintSystem] Extend metatype instance type mismatch coverage
Originally type mismatches associated with metatypes were only covered
for coercions but fix coverage grew since then and now it makes sense
to remove special case and let `repairFailures` take care of it.
2020-01-29 09:40:38 -08:00
Pavel Yaskevich
93c2321106 [TypeChecker] Add types nested in protocol to lookup results
Although such functionality is not yet supported we have to
mirror AST lookup and add such members into results, otherwise
there is a risk of inner/outer results mismatch.
2020-01-29 09:14:25 -08:00
Pavel Yaskevich
217c343eb6 [Diagnostics] NFC: Fix name shadowing diagnostic comment to refer to max 2020-01-29 09:14:25 -08:00
Pavel Yaskevich
ec95397a76 [CSDiag] NFC: Remove obsolete name shadowing diagnostics 2020-01-29 09:14:25 -08:00
Pavel Yaskevich
78fda9ed98 [ConstraintSystem] Use new fix/diagnostic for name shadowing
Stop filtering outer overload choices while trying to pre-check
expression, instead have it always fetch those and use new
fix to only attempt them in diagnostic mode (unless it's min/max
situation with conditional conformances).
2020-01-29 09:14:24 -08:00
Pavel Yaskevich
c9c20afe27 [Diagnostics] Port name shadowing diagnostics
Diagnose an attempt to reference a top-level name shadowed by
a local member e.g.

```swift
extension Sequence {
  func test() -> Int {
    return max(1, 2)
  }
}
```

Here `min` refers to a global function `min<T>(_: T, _: T)` in `Swift`
module and can only be accessed by adding `Swift.` to it, because `Sequence`
has a member named `min` which accepts a single argument.
2020-01-29 09:14:24 -08:00
Pavel Yaskevich
7351bfc86f [CSFix] Add a fix to add a missing qualifier to shadowed top-level name references 2020-01-29 09:14:24 -08:00
swift-ci
3a1c28977d Merge remote-tracking branch 'origin/master' into master-rebranch 2020-01-29 08:04:01 -08:00
Pavel Yaskevich
dd094018de Merge pull request #29528 from xedin/anyobject-conversion-diagnostics
[Diagnostics] Port invalid conversion to AnyObject diagnostic
2020-01-29 08:03:50 -08:00
Pavel Yaskevich
ec3b783380 [Diagnostics] Improve diagnostic for invalid conversion to AnyObject 2020-01-29 00:37:39 -08:00
Pavel Yaskevich
b2083db45d [ConstraintSystem] Add a fix to allow conversion between non-class type and AnyObject 2020-01-29 00:06:57 -08:00
swift-ci
70fa9f3288 Merge remote-tracking branch 'origin/master' into master-rebranch 2020-01-28 16:23:20 -08:00
Holly Borla
608b1b4814 [ConstraintSystem] Allow solving same-type requirements for associated types
where the base does not conform to the associated type's protocol.

We can only reach this case when the solver has already applied a fix for
the conformance failure.
2020-01-28 13:17:53 -08:00
swift-ci
81de94add0 Merge remote-tracking branch 'origin/master' into master-rebranch 2020-01-28 08:23:21 -08:00
swift-ci
be00f516e4 Merge remote-tracking branch 'origin/master' into master-rebranch 2020-01-28 00:43:21 -08:00
Pavel Yaskevich
38aded73b1 [Diagnostics] Add a special case diagnostic for call to init on Void with arguments
Expressions like `Void(...)` have a special locator which ends at
`FunctionArgument` instead of `ApplyArgument` which makes it possible
to type-check `Void()` call successfully. "extraneous arguments" diagnostic
needs to handle such situations specifically e.g. `Void(0)`.
2020-01-28 00:35:51 -08:00
Pavel Yaskevich
c662a91578 Merge pull request #29490 from xedin/remove-more-code-from-visitapplyexpr
[Diagnostics] Don't re-typecheck function expression associated with various calls
2020-01-28 00:32:05 -08:00
swift-ci
1122a6e01e Merge remote-tracking branch 'origin/master' into master-rebranch 2020-01-27 20:44:22 -08:00
Doug Gregor
ccde540fe6 Merge pull request #29487 from DougGregor/constraint-system-localized-opaque-result-type-flag
[Constraint system] Eliminate global flag UnderlyingTypeForOpaqueReturnType
2020-01-27 20:41:29 -08:00
Pavel Yaskevich
e50756c10c [CSDiag] Obsolete function re-typecheck and diagnostics from visitApplyExpr 2020-01-27 17:18:30 -08:00
Pavel Yaskevich
dea79e09c6 [ConstraintSystem] Detect that function type has failures before applying arguments
If a type variable representing "function type" is a hole
or it could be bound to some concrete type with a help of
a fix, let's propagate holes to the "input" type. Doing so
provides more information to upcoming argument and result matching.
2020-01-27 16:53:33 -08:00
Pavel Yaskevich
c7c9510366 [ConstraintSystem] Don't re-attempt to bind type variable if it could be a hole
If type variable is allowed to be a hole and it can't be bound to
this particular (full resolved) type, just ignore this binding
instead of re-trying it later.
2020-01-27 16:53:33 -08:00
Doug Gregor
46a65009e3 [Constraint system] Eliminate global flag UnderlyingTypeForOpaqueReturnType
Make this information contextual (per type) rather than global (per
constraint system) so we don’t misapply it.
2020-01-27 15:44:54 -08:00
Doug Gregor
cc44f22f43 [Function builder] Eliminate unnecessary dependency on UnderlyingTypeForOpaqueReturnType. 2020-01-27 15:01:09 -08:00
swift-ci
46457a03db Merge remote-tracking branch 'origin/master' into master-rebranch 2020-01-27 14:24:21 -08:00
Dan Zheng
b188b90291 [AutoDiff] Minor @differentiable attribute type-checking fix.
Use derivative canonical generic signature to get the derivative generic
environment, not the other way around.

Fixes `@differentiable` attribute SILGen assertion failures on `tensorflow`
branch.
2020-01-27 11:07:23 -08:00
Doug Gregor
d752f414d3 [Constraint solver] Rework solveImpl(Expr*) to return SolutionResult.
SolutionResult better captures what can happen when solving a constraint
system for the given expression occurs than the ad hoc SolutionKind return
& small vector of Solution results. Also, try to make this logic less
convoluted.
2020-01-26 12:05:43 -08:00
Doug Gregor
5063cb5b79 [Constraint solver] Factor out adding a contextual conversion constraint. 2020-01-26 12:05:43 -08:00
Doug Gregor
f7744bd8b2 [Constraint solver] Make DeclContext explicit. NFC 2020-01-26 12:05:43 -08:00
swift-ci
126434e79c Merge remote-tracking branch 'origin/master' into master-rebranch 2020-01-25 14:44:33 -08:00
kelvin13
d71b3dfec8 small vector sizes 2020-01-25 13:50:28 -06:00
Robert Widmann
b09c9957ad Reintroduce NameLookupFlags::IgnoreNewExtensions
Soft revert a09382c. It should now be safe to add this flag back as an optimization to specifically disable lazy member loading instead of all extension loading.

Push the flag back everywhere it was needed, but also push it into lookup for associated type members which will never appear in extensions.
2020-01-25 11:04:53 -08:00
swift-ci
ca63366ce1 Merge remote-tracking branch 'origin/master' into master-rebranch 2020-01-24 14:04:24 -08:00
Pavel Yaskevich
1c0bdc88d3 Merge pull request #29413 from LucianoPAlmeida/remove-visit-identity-expr-csdiag
[Diagnostics] Remove obsolete FailureDiagnosis::visitIdentityExpr from CSDiag
2020-01-24 14:03:31 -08:00
Holly Borla
af847c2f79 Merge pull request #29415 from hborla/ambiguity-special-cases
[CSDiag] Start chipping away at FailureDiagnosis::diagnoseAmbiguity
2020-01-24 13:59:43 -08:00
swift-ci
01ceb5301e Merge remote-tracking branch 'origin/master' into master-rebranch 2020-01-24 12:43:37 -08:00
swift-ci
6238289313 Merge remote-tracking branch 'origin/master' into master-rebranch 2020-01-24 10:24:34 -08:00