Commit Graph

1616 Commits

Author SHA1 Message Date
Slava Pestov
797a7974bc Sema: Fold NominalTypeDecl::computeType() into validateDecl() 2019-10-10 19:55:01 -04:00
Slava Pestov
87cc09c02b AST: Remove some unnecessary calls to setGenericSignature() 2019-10-10 19:54:48 -04:00
Slava Pestov
12231d2df3 Merge pull request #27571 from slavapestov/circular-validation-cleanups-5
Circular validation cleanups, part 5
2019-10-10 19:52:56 -04:00
Slava Pestov
d8b61ff24b Sema: Peel off typeCheckParameterList()'s specifier computation into a request
Since getSpecifier() now kicks off a request instead of always
returning what was previously set, we can't pass a ParamSpecifier
to the ParamDecl constructor anymore. Instead, callers either
call setSpecifier() if the ParamDecl is synthesized, or they
rely on the request, which can compute the specifier in three
specific cases:

- Ordinary parsed parameters get their specifier from the TypeRepr.

- The 'self' parameter's specifier is based on the self access kind.

- Accessor parameters are either the 'newValue' parameter of a
  setter, or a cloned subscript parameter.

For closure parameters with inferred types, we still end up
calling setSpecifier() twice, once to set the initial defalut
value and a second time when applying the solution in the
case that we inferred an 'inout' specifier. In practice this
should not be a big problem because expression type checking
walks the AST in a pre-determined order anyway.
2019-10-10 15:00:07 -04:00
Robert Widmann
4bafc7718e Put More Faith In Raw Values From Synthesized Enums
By requestifying the raw value accessor and pushing the semantic check
into IRGen, we are now partially validating enums that are
synthesized by the clang importer and deserialization - something that
we were not doing before.  The previous check would only skip
the auto-incrementer step when this was the case.  We now also skip the
uniqueness check.

Resolves rdar://56037318
2019-10-10 11:28:45 -07:00
Slava Pestov
29caee2ba6 Sema: Accessors of static members are always static 2019-10-10 13:08:08 -04:00
Slava Pestov
6702d38d87 Sema: Remove most calls to Decl::setValidationToChecked() 2019-10-03 17:11:45 -04:00
Jordan Rose
967be8b422 [ClangImporter] Remove unused variable
Unused after switching to clang::MemberExpr::CreateImplicit in
9f1204d81.
2019-10-02 14:33:50 -07:00
Mishal Shah
2f86d67500 Merge pull request #27396 from shahmishal/master-rebranch
Update master to support apple/stable/20190619 branch for LLVM projects
2019-10-01 10:50:49 -07:00
Robert Widmann
5a8d0744c3 [NFC] Adopt TypeBase-isms for GenericSignature
Structurally prevent a number of common anti-patterns involving generic
signatures by separating the interface into GenericSignature and the
implementation into GenericSignatureBase.  In particular, this allows
the comparison operators to be deleted which forces callers to
canonicalize the signature or ask to compare pointers explicitly.
2019-09-30 14:04:36 -07:00
swift-ci
628d03bbab Merge remote-tracking branch 'origin/master' into master-rebranch 2019-09-25 13:04:19 -07:00
Jordan Rose
dcf607dfa7 [ClangImporter] Remove manual setting of Protocol Self depth (#27352)
At one point in the past we probably needed to set this explicitly,
but now it seems to be handled for us or derived somewhere.

No functionality change.
2019-09-25 12:54:55 -07:00
Brent Royal-Gordon
97febd42a9 Merge branch 'master' into master-rebranch
# Conflicts:
#	lib/TBDGen/TBDGen.cpp
2019-09-24 18:52:04 -07:00
Jordan Rose
80e646642f [ClangImporter] importMethodType -> importMethodParamsAndReturnType (#27349)
And similar for importFunctionParamsAndReturnType and
importAccessorParamsAndReturnType. In all cases the return type isn't
a FunctionType, and there's also a ParameterList out-parameter.

No functionality change.
2019-09-24 18:39:03 -07:00
swift-ci
d41eac4336 Merge remote-tracking branch 'origin/master' into master-rebranch 2019-09-20 17:04:10 -07:00
Jordan Rose
311607ec40 [ClangImporter] Simplify typedef bridgeability checking
A typedef might get imported as an alias for a bridged type (String)
or for the original type (NSString), and a few parts of the importer
need to account for this. Simplify this logic based on how it's used
today.
2019-09-19 19:44:07 -07:00
swift-ci
463b04648e Merge remote-tracking branch 'origin/master' into master-rebranch 2019-09-18 15:03:46 -07:00
Robert Widmann
5e34169aca Separate computing interface types and underlying types
Computing the interface type of a typealias used to push validation forward and recompute the interface type on the fly.  This was fragile and inconsistent with the way interface types are computed in the rest of the decls.  Separate these two notions, and plumb through explicit interface type computations with the same "computeType" idiom.  This will better allow us to identify the places where we have to force an interface type computation.

Also remove access to the underlying type loc.  It's now just a cache location the underlying type request will use.  Push a type repr accessor to the places that need it, and push the underlying type accessor for everywhere else.  Getting the structural type is still preferred for pre-validated computations.

This required the resetting of a number of places where we were - in many cases tacitly - asking the question "does the interface type exist".  This enables the removal of validateDeclForNameLookup
2019-09-17 08:20:55 -07:00
swift-ci
d4521dc7a1 Merge remote-tracking branch 'origin/master' into master-rebranch 2019-09-10 09:24:32 -07:00
Jordan Rose
d4ac04d25e Move access-path filtering into ModuleNameLookup (out of lookupValue) (#27097)
Removes duplicated logic from the implementations of
FileUnit::lookupValue, and simplifies the interface to
ModuleDecl::lookupValue, where everyone was passing an empty
(non-filtering) access path anyway /except/ during actual lookup from
source code. No functionality change.
2019-09-10 09:13:20 -07:00
swift-ci
e6fd1101e1 Merge remote-tracking branch 'origin/master' into master-rebranch 2019-09-07 14:03:41 -07:00
Saleem Abdulrasool
ac1d43b7c8 ClangImporter: repair build on Windows
Explicitly apply the std::move as the signature of the callee is:
  void swift::Evaluator::cacheOutput<swift::ExtendedNominalRequest, _>(const Request &, swift::NominalTypeDecl *&&)

The second formal parameter here is a `swift::ClassDecl` which is a
subclass of NominalTypeDecl, however, the cast will construct a
`swift::NominalTypeDecl *`.  This is a lvalue and cannot be bound to a
r-value reference.  Explicitly construct the r-value reference via
`std::move`.
2019-09-07 11:13:39 -07:00
swift-ci
927fc3f39e Merge remote-tracking branch 'origin/master' into master-rebranch 2019-09-06 20:03:38 -07:00
swift-ci
5b3fdba240 Merge remote-tracking branch 'origin/master' into master-rebranch 2019-09-06 17:23:34 -07:00
Robert Widmann
d4bb9a5cfe Define GenericParamListRequest
GenericParamListRequest formalizes the lazy generic parameter list construction pattern we were performing before.
2019-09-06 17:22:30 -07:00
swift-ci
9bf6d8689d Merge remote-tracking branch 'origin/master' into master-rebranch 2019-09-06 14:23:36 -07:00
Slava Pestov
f292c1b240 AST: Remove GenericContext::setGenericEnvironment()
This was a transitional step before converting all callers to
store a generic signature instead of an environment.
2019-09-06 17:16:04 -04:00
Slava Pestov
1e94466bcc AST: Replace GenericSignature::createGenericEnvironment() with getGenericEnvironment()
This memoizes the result, which is fine for all callers; the only
exception is open existential types where each new open existential
now explicitly gets a unique generic environment, allocated by
calling GenericEnvironment::getIncomplete().
2019-09-06 17:16:03 -04:00
Slava Pestov
99ea1bb980 ClangImporter: Sink getEffectiveClangNode() down from IDE to the importer and clean up related code 2019-09-06 16:03:51 -04:00
swift-ci
a72ef5d912 Merge remote-tracking branch 'origin/master' into master-rebranch 2019-09-06 11:43:03 -07:00
Varun Gandhi
f2f63882e2 [NFC] Always use syntactic information in ExtendedNominalRequest.
Since we started saving the nominal in the .swiftmodule, changing the other
call-sites in ClangImporter to save the value means that we can rely on
the typeRepr being non-null except when the syntax tree was ill-formed.
2019-09-05 15:33:02 -07:00
swift-ci
eb52f0c448 Merge remote-tracking branch 'origin/master' into master-rebranch 2019-09-04 15:23:47 -07:00
Slava Pestov
a09382ce2b AST: Completely remove NominalTypeDecl::LookupDirectFlags::IgnoreNewExtensions 2019-09-03 22:53:52 -04:00
Slava Pestov
89d5725c63 ClangImporter: Delay building imported conformances until we ask for them 2019-09-03 22:53:52 -04:00
Slava Pestov
be84556b9e ClangImporter: Record the error wrapper's struct 'Code' member enum in a side table 2019-09-03 22:53:52 -04:00
Slava Pestov
220bc64064 ClangImporter: Directly track constructors imported into a nominal type
This avoids a re-entrant lookup while doing lazy member loading,
and eliminates a usage of LookupDirectFlags::IgnoreNewExtensions,
and the last usage of NominalTypeDecl::makeMemberVisible().
2019-09-03 22:39:36 -04:00
Slava Pestov
c87e1a23db Sema: Try harder not to page in all members of imported classes 2019-09-03 22:39:35 -04:00
Slava Pestov
75f4625bee AST: Peel off ClangModuleLoader.h from ASTContext.h 2019-09-03 22:39:35 -04:00
swift-ci
b08854787c Merge remote-tracking branch 'origin/master' into master-rebranch 2019-08-29 16:43:42 -07:00
Jordan Rose
6e25fd9ca4 Stop hiding '@frozen' from code completion (#26942)
And print it explicitly on imported NS_CLOSED_ENUMs.
2019-08-29 16:42:18 -07:00
swift-ci
5c025a7b77 Merge remote-tracking branch 'origin/master' into master-rebranch 2019-08-27 11:23:51 -07:00
Robert Widmann
8d22702a22 Use Integrated Caching
Replumb the TypeLoc for the extended type as a TypeRepr instead. Fixup
the myriad callsites this touches in the process.
2019-08-26 11:48:29 -07:00
swift-ci
abb9f9b8ab Merge remote-tracking branch 'origin/master' into master-rebranch 2019-08-26 11:05:16 -07:00
Doug Gregor
f277280093 [Clang importer] Swift over to the abstract generic signature request. 2019-08-26 09:54:20 -07:00
swift-ci
fbe8e56e8b Merge remote-tracking branch 'origin/master' into master-rebranch 2019-08-24 10:03:05 -07:00
Slava Pestov
2ff39d227c AST: Remove some unused LazyResolver usages 2019-08-23 22:13:34 -04:00
swift-ci
3869e829fa Merge remote-tracking branch 'origin/master' into master-rebranch 2019-08-20 14:43:57 -07:00
Slava Pestov
62f18a52c0 Sema: Move attribute checking to typeCheckDecl() 2019-08-20 14:47:52 -04:00
swift-ci
d28622d4ac Merge remote-tracking branch 'origin/master' into master-rebranch 2019-08-19 21:43:25 -07:00
Slava Pestov
ccae884b2d ClangImporter: Try harder not to add accessors to their parent context
Unfortunately I don't have a test case for this one.
2019-08-19 23:00:57 -04:00