Commit Graph

1316 Commits

Author SHA1 Message Date
Nathan Hawes
4fd0cdc2ef Fix up calls to clang::Type::dump() now that it requires a clang::ASTContext. 2020-07-07 15:05:34 -07:00
Dan Zheng
71dbe2b65c NFC: silence some -Wrange-loop-analysis warnings. (#32634) 2020-06-30 20:40:20 -07:00
Rintaro Ishizaki
9044aa0376 [AST] ParamDecl::isNonEphemeral() not to evaluate InterfaceTypeRequest
'-dump-parse' for the following code used to hit an assertion failure:

  struct MyStruct {}
  _ = { (val: MyStruct) in }

Because 'isNonEphemeral()' on 'val' parameter unintentionally causes
'InterfaceTypeRequest::evaluate()'. Since 'isNonEphemeral()' inference
based on the interface type is not possible after type checking, return
'false' unless 'hasInterfaceType()'

Also:
  * Dump parameter list on 'EnumElementDecl' as well
  * Adjust the position of 'range=...' in parameter list dumping
2020-06-25 15:01:27 -07:00
Anthony Latsis
01e6cb35a9 Merge pull request #31812 from AnthonyLatsis/substitution-revolution-pre-1
[NFC] AST: Define SubstitutionMap::getInnermostReplacementTypes
2020-06-20 00:11:07 +03:00
Rintaro Ishizaki
4358502676 [CodeCompletion] Update CodeCompletionExpr::dump to dump base exprssion 2020-06-17 13:45:14 -07:00
Robert Widmann
a748d8ed77 [NFC] Fixup RequirementRepr Printing To Use Only the Repr
If a semantic representation of the RequirementRepr is needed, then it should be resolved to a Requirement and printed.
2020-06-11 16:18:23 -07:00
Robert Widmann
e1015761fb [NFC] Reduce usage of TypedPattern::getTypeLoc 2020-06-10 16:51:10 -07:00
Robert Widmann
2371e5c260 Strip TypeLoc from EnumElementPattern 2020-06-10 14:22:46 -07:00
Robert Widmann
fc9070c072 Strip TypeLoc from IsPattern 2020-06-10 13:29:39 -07:00
Robert Widmann
ca728917e1 Merge pull request #32138 from AnthonyLatsis/eliminate-typeloc
Sema: Remove TypeLoc from ExplicitCastExpr (via TypeExpr)
2020-06-10 11:28:50 -07:00
Anthony Latsis
4b4634141f Sema: Remove TypeLoc from ExplicitCast 2020-06-09 15:20:25 +03:00
Hamish Knight
1ed810653c [Frontend] Remove performParseOnly
Most clients were only using it to populate the
main module with files, which is now done by
`getMainModule`. Instead, they can now just rely
on parsing happening lazily.
2020-06-08 12:44:15 -07:00
Doug Gregor
ad42d477f7 [AST] Remove some pointless uses of hasSingleExpressionBody(). 2020-06-03 22:55:23 -07:00
Anthony Latsis
dfbbd727bf [NFC] AST: Rename TypeAliasType::getInnermostGenericArgs to getDirectGenericArgs 2020-05-15 14:07:40 +03:00
Brent Royal-Gordon
ec6bc5bdc9 Merge pull request #31573 from brentdax/explicit-iuo
[NFC] Include implicit-unwrap bit in AST dump
2020-05-06 10:43:01 -07:00
Brent Royal-Gordon
b3f79f7a40 [NFC] Include implicit-unwrap bit in AST dump
There’s a bit in the AST indicating whether a ForceValueExpr is an implicitly-inserted unwrap of an IUO, but it’s not included in the AST dump. Add it.
2020-05-05 19:00:29 -07:00
Hamish Knight
b7320cd6d5 [AST] Collapse two arrays into one
Store an array of Located<Identifier> instead of
an array of Identifiers and SourceLocs on
OperatorDecl. This allows us to cleanup
OperatorPrecedenceGroupRequest a little.
2020-05-01 10:38:34 -07:00
Pavel Yaskevich
a483b344ee [AST] Drop const qualifier from {get/set}Type callbacks 2020-04-29 17:03:45 -07:00
Pavel Yaskevich
87b8f79d2c [AST] Extend ASTNode to support Pattern/TypeLoc 2020-04-29 17:03:45 -07:00
Robert Widmann
f9463922fd Merge pull request #31390 from CodaFi/tone-loc
Strip Out More TypeLocs
2020-04-29 16:46:00 -07:00
Anthony Latsis
882a89b81f Merge pull request #31415 from AnthonyLatsis/se-0267-ast-dump
ASTDumper: print contextual 'where' clauses where necessary
2020-04-30 01:29:11 +03:00
Anthony Latsis
5fe21dc528 ASTDumper: print contextual where clauses on extensions and non-generic type decls 2020-04-29 22:33:38 +03:00
Robert Widmann
f9a506d799 [NFC] Strip EditorPlaceholderExpr of its TypeLoc 2020-04-28 20:10:10 -07:00
Arnold Schwaighofer
c80776bd1a Update code to print conformances if SILPrintGenericSpecializationInfo is true 2020-04-27 13:30:34 -07:00
Anthony Latsis
74252028ca AST: Rename getFullName -> getName on ValueDecl & MissingMemberDecl 2020-04-23 05:16:55 +03:00
Brent Royal-Gordon
4619e2eee6 Merge pull request #31199 from brentdax/pathfinder
Fix layering of cross-import and clang overlays
2020-04-22 16:37:28 -07:00
Anthony Latsis
a50b2cda38 ASTDumper: Fix missing trailing apostrophe when dumping typealias underlying type 2020-04-22 19:11:21 +03:00
Brent Royal-Gordon
823d3d4271 [NFC] Indicate foreign modules in AST dumps 2020-04-21 23:39:03 -07:00
Hamish Knight
92103a7c63 [AST] Remove SourceFile::addImports
Temporarily replace with `SourceFile::setImports`
until import resolution is requestified. Now
imports are only set once for a given SourceFile.

Because we're now asserting in more places that
import resolution must have run before querying
imports, this commit also adds
`getCachedUnderlyingType` to TypeAliasDecl to stop
the ASTDumper from trying to query imports for a
-dump-parse invocation.
2020-04-20 13:20:35 -07:00
Holly Borla
66e85721cb Merge pull request #30807 from hborla/property-wrapper-refactoring
[Property Wrappers] Refactor property wrappers so the synthesized backing init is only type checked once
2020-04-14 10:48:22 -07:00
swift-ci
9a0efcac2a Merge pull request #30548 from AnthonyLatsis/sr-7855 2020-04-13 13:20:27 -07:00
Holly Borla
65105f3a26 [Property Wrappers] Introduce a new Expr node for the property wrapper
wrapped value placeholder in an init(wrappedValue:) call that was previously
injected as an OpaqueValueExpr. This commit also restores the old design of
OpaqueValueExpr.
2020-04-09 16:00:57 -07:00
Suyash Srijan
724f8c23db [Typechecker] Implement SE-0268 Refine didSet Semantics (#26632) 2020-04-09 01:23:15 +01:00
Andrew Trick
8da6b72757 Make -emit-verbose-sil print conformances for existential insts.
It is a correctness bug that textual SIL cannot parse these, but at
least we can somewhat debug the issue now.
2020-04-07 13:53:27 -07:00
Owen Voorhees
43e2d107e1 [SE-0276] Implement multi-pattern catch clauses
Like switch cases, a catch clause may now include a comma-
separated list of patterns. The body will be executed if any
one of those patterns is matched.

This patch replaces `CatchStmt` with `CaseStmt` as the children
of `DoCatchStmt` in the AST. This necessitates a number of changes
throughout the compiler, including:
- Parser & libsyntax support for the new syntax and AST structure
- Typechecking of multi-pattern catches, including those which
  contain bindings.
- SILGen support
- Code completion updates
- Profiler updates
- Name lookup changes
2020-04-04 09:28:26 -07:00
Holly Borla
d22b984a93 [Expr] Allow OpaqueValueExpr to store an underlying expression 2020-04-03 13:47:56 -07:00
Anthony Latsis
d0ae3ee580 [AST] Replace FuncDecl::getName & EnumElementDecl::getName with ValueDecl::getBaseIdentifier 2020-03-29 00:35:51 +03:00
marcrasi
f6562d3a67 [AutoDiff upstream] differentiable function conversion pipeline (#30660)
Add the `@differentiable` function conversion pipeline:

- New expressions that convert between `@differentiable`,
  `@differentiable(linear)`, and non-`@differentiable` functions:
  - `DifferentiableFunction`
  - `LinearFunction`
  - `DifferentiableFunctionExtractOriginal`
  - `LinearFunctionExtractOriginal`
  - `LinearToDifferentiableFunction`
- All the AST handling (e.g. printing) necessary for those expressions.
- SILGen for those expressions.
- CSApply code that inserts these expressions to implicitly convert between
  the various function types.
- Sema tests for the implicit conversions.
- SILGen tests for the SILGen of these expressions.

Resolves TF-833.
2020-03-27 01:27:39 -07:00
Anthony Latsis
a826da5979 [Sema] Fixits for assoc. type restatement hints should account for where clauses 2020-03-21 05:31:37 +03:00
Joe Groff
719002b08e Merge pull request #30365 from jckarter/substitution-map-mismatches
Create an inherited conformance in SubstitutionMap::lookupConformance when needed.
2020-03-12 08:39:44 -07:00
Dmitri Gribenko
a058d990e1 Added dumping for SILBoxTypeRepr 2020-03-12 11:29:11 +01:00
Joe Groff
9e12b3749e Dump component types of SILFunctionType 2020-03-10 15:19:56 -07:00
Hamish Knight
c26eb11baf Merge pull request #30190 from hamishknight/the-beginning-of-the-pipeline-end
Requestify SourceFile parsing
2020-03-05 11:17:24 -08:00
Slava Pestov
98902ef142 AST: Set PrintForSIL when printing replacement types in SubstitutionMaps
This prints opened existentials with @opened("...") rather than just printing
the erased existential type.
2020-03-04 19:32:14 -05:00
Hamish Knight
011f4f1584 Requestify SourceFile parsing
Add ParseSourceFileRequest that parses a SourceFile
for its top-level decls.
2020-03-03 15:53:18 -08:00
Robert Widmann
3bd0044143 [Gardening] Remove remaining casting artifacts 2020-02-07 16:09:31 -08:00
John McCall
faee21b626 Implement Swift serialization and deserialization of Clang types.
As part of this, we have to change the type export rules to
prevent `@convention(c)` function types from being used in
exported interfaces if they aren't serializable.  This is a
more conservative version of the original rule I had, which
was to import such function-pointer types as opaque pointers.
That rule would've completely prevented importing function-pointer
types defined in bridging headers and so simply doesn't work,
so we're left trying to catch the unsupportable cases
retroactively.  This has the unfortunate consequence that we
can't necessarily serialize the internal state of the compiler,
but that was already true due to normal type uses of aggregate
types from bridging headers; if we can teach the compiler to
reliably serialize such types, we should be able to use the
same mechanisms for function types.

This PR doesn't flip the switch to use Clang function types
by default, so many of the clang-function-type-serialization
FIXMEs are still in place.
2020-02-06 22:09:00 -05:00
Argyrios Kyrtzidis
5c956ba2e1 [AST/ASTDumper] Fix linker error for SWIFT_BUILD_ONLY_SYNTAXPARSERLIB build
With such a build we avoid linking the `clangAST` library.
2020-01-30 22:09:14 -08:00
Brent Royal-Gordon
6c99bdac1e [NFC] Extract helper for making magic identifier strings 2020-01-21 14:28:16 -08:00
Robert Widmann
19f0d52eca Merge pull request #28995 from CodaFi/absolutely-path-ological
[NFC] Hide SourceFile::Decls
2020-01-06 18:48:55 -08:00