Commit Graph

11023 Commits

Author SHA1 Message Date
Pavel Yaskevich
1ea3ebc805 Merge pull request #18780 from xedin/refactor-decl-req-diags-into-method
[Diagnostics] NFC: Move logic common to all requirement failures into…
2018-08-17 11:58:16 -07:00
Jordan Rose
a17dbfbf29 Merge pull request #18778 from jrose-apple/towards-stability
[ModuleInterface] More changes to printing and parsing .swiftinterface files
2018-08-17 09:10:57 -07:00
John McCall
4a43ee83e7 Merge pull request #18770 from rjmccall/select-bind-constraint-fix
Simplify to a common type variable when picking a disjunction of bindings
2018-08-16 23:23:20 -04:00
Pavel Yaskevich
6756c57f91 [Diagnostics] NFC: Move logic common to all requirement failures into RequirementFailure
This is going to make adding same-type and superclass requirement
failures might easier, because they only have to supply custom
diagnostic messages and substituted types.
2018-08-16 18:35:24 -07:00
Jordan Rose
c62fcad553 Don't synthesize initializers in swiftinterface files
...and then don't complain about a class not having any initializers.
2018-08-16 17:59:24 -07:00
Jordan Rose
0ca78265ef [ModuleInterface] Allow global/static variables without initial values 2018-08-16 17:59:24 -07:00
Jordan Rose
2f1b464844 Cut down conformance checking time by reusing RequirementEnvironments (#18598)
Trade an extra copy for saving the cost of reinitialization when there
are a lot of witnesses to check. A small but measurable win when
type-checking the standard library.

Also add a test to make sure we still get the requirement environment
right for covariant 'Self'.
2018-08-16 17:25:42 -07:00
Greg Titus
ec9d114bcb Merge pull request #18757 from gregomni/optional-as
[Sema] Improve type coercion fixits for optional-to-optional conversions.
2018-08-16 15:32:12 -07:00
John McCall
f6d933b032 When picking a binding disjunction, try to simplify to a common TV. 2018-08-16 18:27:29 -04:00
Pavel Yaskevich
fc4137052d Merge pull request #18752 from xedin/add-get-req-dc-to-failure
[Diagnostics] Extract requirement declaration context retrieval into …
2018-08-16 13:28:20 -07:00
gregomni
78fba7e1d0 Add optional back onto the toType rather than manually adding a '?' 2018-08-16 13:14:50 -07:00
Harlan
9b29e8dc91 Merge pull request #18454 from harlanhaskins/requests-ive-had-a-few
Remove SimpleRequest::breakCycle
2018-08-16 11:03:22 -07:00
Ben Cohen
428c580158 Fix unused variable warnings in release builds. (#18755) 2018-08-16 11:46:45 -06:00
Pavel Yaskevich
3a6b1e9454 Merge pull request #18753 from xedin/add-kind-to-req-locator
[ConstraintSystem] Add `kind` to generic requirement locator
2018-08-16 10:20:18 -07:00
gregomni
ca48ebf390 Improve type coercion fixits for optional-to-optional conversions. 2018-08-16 09:43:47 -07:00
Greg Titus
34f6a1f3f2 Merge pull request #18699 from gregomni/opty3
[ConstraintSystem] Further unwrap cleanup
2018-08-16 08:37:53 -07:00
Pavel Yaskevich
2db0e60275 [ConstraintSystem] Add kind to generic requirement locator
Having requirement kind encoded in the locator helps to identify
what kind of fix to generate (applicable to same-type, superclass)
without retrieving requirement itself.
2018-08-16 01:45:52 -07:00
Pavel Yaskevich
0f411b1102 [Diagnostics] Extract requirement declaration context retrieval into its own method
Change logic to traverse the chain of declaration contexts
starting for "affected" declaration's parent and check if the
requirement is satisfied by one of them, if so return it as
requirement's declaration context.

Extract this logic into a method on `RequirementFailure` to make
it accessible for other types of requirement failure diagnostics.
2018-08-16 01:25:51 -07:00
swift-ci
8b561ade53 Merge pull request #18750 from rjmccall/misc-cleanups-for-coroutines 2018-08-16 00:57:20 -07:00
Rintaro Ishizaki
5753e122cf Merge pull request #18721 from rintaro/ide-rdar41224316
[CodeCompletion] Remove unresolved type in prepareForRetypechecking()
2018-08-16 15:46:51 +09:00
John McCall
1c99f31f20 Basic motions towards moving yields into AnyFunctionType.
Still not intending to do this anytime soon.
2018-08-16 02:13:54 -04:00
John McCall
5d8252b8c6 Pass around whether storage is mutable as an enum instead of a bool. 2018-08-16 02:13:54 -04:00
Harlan Haskins
5a6985f39e Remove SimpleRequest::breakCycle
This patch removes the need for Request objects to provide a default
cycle-breaking value, instead opting to return llvm::Expected so clients
must handle a cycle failure explicitly.

Currently, all clients do the 'default' behavior, but this opens the
possibility for future requests to handle failures explicitly.
2018-08-15 11:01:12 -07:00
swift-ci
be0e1643d6 Merge pull request #18720 from DougGregor/kill-type-resolver-context-generic-signature 2018-08-15 10:55:08 -07:00
Doug Gregor
876738fabe Merge pull request #18718 from DougGregor/cleanup-type-lookup
[Name lookup] Clean up qualified and type lookup
2018-08-15 10:03:41 -07:00
Doug Gregor
50763fc641 [AST] Re-establish assertion about inheritance relationship in getSuperclassForDecl()
When we fail to find a particular superclass type of a type in ill-formed
code, make sure that we were right to look here at all. This re-establishes
a check I had recently weakened.
2018-08-15 09:27:36 -07:00
Doug Gregor
ac79fa20af [Type checker] Fix DeclContext computation for inherited type lookup. 2018-08-15 08:20:08 -07:00
Rintaro Ishizaki
9481e01845 [ConstraintSystem] Defensive guard not to join unresolved type
in PotentialBindings::addPotentialBinding()
2018-08-15 20:40:05 +09:00
Rintaro Ishizaki
c68157a27d [CodeCompletion] Remove unresolved type in prepareForRetypechecking()
Unresolved type attached to expressions may fail re-typechecking.
Also, disallow unresolved type in typeCheckCompletionSequence(). It doesn't
provide useful completions to developers.

rdar://problem/41224316
2018-08-15 20:39:12 +09:00
Doug Gregor
92d622ab41 [Type checker] Eliminate TypeResolverContext::GenericSignature.
The name-lookup behavior that avoids looking for members of a nominal type
or extension therefore when resolving the inheritance clause is now
handled by UnqualifiedLookup, so remove it from the type checker itself.

Fixes rdar://problem/39130543.
2018-08-14 23:17:57 -07:00
Pavel Yaskevich
917783e2d7 [ConstraintSystem] Don't try to eagerly deallocate fixes
`Fix` life-time is pretty limited as it is, and we'd have
to distinguish between standalone fixes and ones attached
to constraints, which is not worth the trouble.

Resolves: rdar://problem/43285774
2018-08-14 13:52:29 -07:00
Doug Gregor
6e2d3fe355 [AST/TypeChecker] Remove DynamicLookup flag.
We detect whether we’re performing AnyObject lookup based on 
whether we are looking into AnyObject; these two DynamicLookup
flags are unused.
2018-08-14 11:32:55 -07:00
swift-ci
cd7415025e Merge pull request #18700 from DougGregor/redundant-duplicate-inheritance 2018-08-14 09:37:41 -07:00
gregomni
0db31c9f94 Don't attempt invalid bindings that we expect to need fixes if shouldAttemptFixes is off. 2018-08-14 09:14:59 -07:00
gregomni
4d862d50cb In tryTypeVariableBindings, if T? fails, try T for all binding kinds (previously just allowed for Subtypes). This allows us to always find MissingOptionalUnwrapFailures, so that all the unwrap fixit code can be moved into CSDiagnostics and made static. 2018-08-14 09:14:59 -07:00
Greg Titus
8f41ee7750 Merge pull request #18324 from gregomni/opty2
[Sema] More unwrap fixits
2018-08-14 09:12:35 -07:00
Doug Gregor
4d7e7dbee2 Remove the unused TypeResolverFlags::ResolveStructure.
I removed all uses of this in a previous pull request, but my
incorrect rebase onto master (following the introduction of 
TypeResolverContext) left the flag there. Remove it again. NFC
2018-08-14 09:07:22 -07:00
Doug Gregor
13256d34ca [Type checker] Eliminate redundant "duplicate inheritance" diagnostics.
The GenericSignatureBuilder and ConformanceLookupTable handle duplication
diagnostics for protocols that occur in the inheritance clause. Avoid
redundantly diagnosing these within checkInheritanceClause().
2018-08-14 08:38:49 -07:00
Doug Gregor
32d8f8aaac Merge pull request #18562 from DougGregor/remove-shadowed-without-validation
[Name lookup] Make shadowing less reliant on the type checker.
2018-08-14 10:50:37 -04:00
Slava Pestov
6be2762900 Merge pull request #18697 from slavapestov/minor-irgen-cleanups
Minor IRGen cleanups
2018-08-14 03:05:51 -07:00
Slava Pestov
dffcafbdb7 IRGen: VarDecls always have an interface type and a contextual type 2018-08-14 02:19:31 -07:00
Doug Gregor
5e0a7fdab9 [Name lookup] Teach shadowing to avoid validating decls until needed.
Rather than validating the signature of any declaration found by
name lookup, first check whether there is a collision on the full name
of the declaration. This should result in fewer declaration validations.
2018-08-14 02:19:13 -07:00
Doug Gregor
6384d080b1 Merge pull request #18539 from DougGregor/unqualified-lookup-via-decls
[Name lookup] Use decl-based name lookup more regularly
2018-08-14 05:18:59 -04:00
Pavel Yaskevich
0926808726 Merge pull request #18664 from xedin/cs-improve-fix-interface
[ConstraintSystem] Replace `Fix` with richer `ConstraintFix` interface
2018-08-14 00:13:01 -07:00
Doug Gregor
713c92d81b [Type checker diags] Validate constructors when they don’t have interface types.
Fixes a diagnostics regression due to the name-shadowing changes.
2018-08-13 22:31:09 -07:00
Slava Pestov
d31d35a788 AST: Remove a few usages of TypeBase::getInOutObjectType() 2018-08-13 21:13:10 -07:00
Slava Pestov
31a570d53c AST: Replace TypeBase::getRValueInstanceType() with getMetatypeInstanceType()
That is, don't look through InOutType anymore, and update callers to
call getInOutObjectType() as well (or not, where it was obvious to me
that InOutType could not appear).

This surfaces more remaining uses of getInOutObjectType() directly.
2018-08-13 21:13:10 -07:00
Pavel Yaskevich
3ba8325c3f Merge pull request #18691 from xedin/fix-missing-conformance-diags-to-skip-all-operators
[Diagnostics] Don't try to diagnose missing conformance for any type …
2018-08-13 19:38:54 -07:00
Doug Gregor
1247e5fb32 [Type checker] Eliminate TypeResolutionFlags::ResolveStructure.
It’s no longer introduced anywhere. NFC
2018-08-13 19:03:35 -07:00
Doug Gregor
064652693b Remove LazyResolver::resolveExtensionForConformanceConstruction().
This is no longer used. NFC
2018-08-13 19:03:35 -07:00