Commit Graph

1273 Commits

Author SHA1 Message Date
swift-ci
9885d9e133 Merge remote-tracking branch 'origin/master' into master-next 2018-06-21 09:10:01 -07:00
Joe Groff
d17b767361 Merge pull request #17219 from fedetrim/master
[SR-7904] Add source filenames in the output of `-dump-ast`
2018-06-21 08:59:43 -07:00
swift-ci
01fe4cdcd7 Merge remote-tracking branch 'origin/master' into master-next 2018-06-20 19:09:02 -07:00
Huon Wilson
10b30fef78 [GSB] Explicit error on unsupported conditional conformance recursion.
This doesn't fix the fundamental problem of correctly handling such cases, but
it is better than the "error message" that occurred previously:

    Assertion failed: ((bool)typeSig == (bool)extensionSig && "unexpected generic-ness mismatch on conformance").

Fixes the crash rdar://problem/41281406 (that in
https://bugs.swift.org/browse/SR-6569 (rdar://problem/36068136)),
https://bugs.swift.org/browse/SR-8019 (rdar://problem/41216423) and
https://bugs.swift.org/browse/SR-7989 (rdar://problem/41126254).
2018-06-21 10:53:30 +10:00
swift-ci
8eae3f0fc4 Merge remote-tracking branch 'origin/master' into master-next 2018-06-18 17:09:50 -07:00
swift-ci
8f23048c85 Merge pull request #17097 from brentdax/noescape-from-the-ast-dump-scrape 2018-06-18 16:59:37 -07:00
Federico Trimboli
63f0697df1 [SR-7904] Add source filenames in the output of -dump-ast 2018-06-15 11:29:29 -03:00
Bob Wilson
5df3d1f100 Merge remote-tracking branch 'origin/master' into master-next 2018-06-14 20:51:48 -07:00
John McCall
9022b5152f Rename accessor kinds from IsGetter -> IsGet, etc.
Introduce some metaprogramming of accessors and generally prepare
for storing less-structured accessor lists.

NFC except for a change to the serialization format.
2018-06-14 17:08:55 -04:00
swift-ci
1bb550e4ea Merge remote-tracking branch 'origin/master' into master-next 2018-06-11 16:49:21 -07:00
Bob Wilson
033b884de6 [master-next] Replace use of F_RW flag that was removed in LLVM r334221
Use a combination of the new FA_Read and FA_Write flags instead.
2018-06-11 14:53:35 -07:00
Robert Widmann
7d82e70f2c Excise getInput() from printing
Not NFC because it changes the printing behavior for function type
parameters.  They are no longer reported as types (paren, tuple, or raw),
but as Params.
2018-06-10 19:40:26 -07:00
Brent Royal-Gordon
fb79b8f44e Indicate which closures are escaping in AST dumps 2018-06-10 14:03:01 -07:00
Doug Gregor
147e6e937f Merge pull request #16778 from brentdax/semantic-expr-dump
Dump semantic expressions in AST consistently
2018-05-23 15:06:11 -07:00
Brent Royal-Gordon
e6debec9c4 Dump various nodes’ semanticExprs
Previously, only DictionaryExpr dumped its semanticExpr, and it replaced the direct contents. With this change, all nodes with a semanticExpr dump it, and they all handle it in the same way: they append it to the end of the list of children, in a separate S-expression marked by “semantic_expr”.
2018-05-22 14:17:21 -07:00
Brent Royal-Gordon
531109ca1f Add closing paren after ObjectLiteralExpr dump 2018-05-22 14:14:04 -07:00
Mark Rowe
88629e9dbc Include source ranges for statements in the AST dump. 2018-05-17 10:50:19 -07:00
Mark Rowe
b4481a1300 Include source ranges for parameter lists in the AST dump. 2018-05-17 10:50:19 -07:00
Mark Rowe
62eb12b652 Include source ranges for decls in the AST dump. 2018-05-17 10:50:19 -07:00
Ben Langmuir
f20586b3d8 Revert "Include source ranges for statements, declarations, and parameter lists in the AST dump" 2018-05-17 09:53:05 -07:00
Jordan Rose
cb6c8f0a8e Merge pull request #16473 from bdash/ast-dump-source-ranges
Include source ranges for statements, declarations, and parameter lists in the AST dump
2018-05-17 09:16:35 -07:00
Mark Rowe
4ba6dd3a92 Fix some style issues. 2018-05-15 10:24:27 -07:00
Huon Wilson
35cc2d65e4 [AST] Desugar associated types in ProtocolConformance::dump.
Otherwise, since typealiases are used so often, one ends up with dumps
that say nothing new/useful:

    (normal_conformance type=X protocol=P
      (assoc_type req=A type=X.A))
2018-05-16 00:57:26 +10:00
Huon Wilson
835c2c9c48 [AST] Break recursion in SubstitutionMap::dump too. 2018-05-15 22:17:52 +10:00
Huon Wilson
ad503e913e [AST] Don't \n when dumping an abstract ProtocolConformanceRef as part of a larger dump. 2018-05-15 22:17:52 +10:00
Huon Wilson
9d13361964 [AST] Introduce a minimal SubstitutionMap dump for use inside expressions.
Within a dump of a DeclRef (or, more likely, a larger entity that includes one),
the full multiline details of a substitution map are likely to not be hugely
relevant, and just get in the way of understanding the interesting parts of the
dump. Thus, this is a variant that is a single line and just includes the
substitutions; the conformances (or, at least, the protocols involved) can be
inferred from the generic signature combined with those substitutions.

The style is controlled via a enum rather than a boolean, to avoid problems with
trying to pass an indent like `map->dump(out, indent)`, where the integer indent
coerces to a bool, rather than error.

Fixes rdar://problem/40074968.
2018-05-15 22:17:52 +10:00
Huon Wilson
dad4169333 [AST] Make dumping for SubstitutionMap lisp-formatted and indent-aware.
This is much easier to read when part of a larger dump, where it now occurs in
expressions and specialized conformances.

Part of rdar://problem/40074968.
2018-05-15 22:17:52 +10:00
Huon Wilson
f2e2f837b5 [AST] Make dumping a recursive conformance not a horrible mistake.
A recursive conformance would previously recur infinitely, but now prints just
the header plus "(details printed above)".

Fixes (most of) rdar://problem/40074968
2018-05-15 22:17:52 +10:00
Doug Gregor
ef020c74aa Eliminate all vestiges of Substitution and SubstitutionList.
Introduced during the bring-up of the generics system in July, 2012,
Substitution (and SubstitutionList) has been completely superseded by
SubstitutionMap. R.I.P.
2018-05-11 21:43:40 -07:00
Mark Rowe
c58dcfc5cc Include source ranges for statements in the AST dump. 2018-05-09 11:15:35 -07:00
Mark Rowe
46f95d615d Include source ranges for parameter lists in the AST dump. 2018-05-09 11:15:35 -07:00
Mark Rowe
28af6959b8 Include source ranges for decls in the AST dump. 2018-05-09 11:15:35 -07:00
Mark Rowe
ffe6a8756e Remove an unmatched single quote from unresolved_member_expr 2018-05-03 11:44:50 -07:00
Mark Rowe
8bcff89790 Add a missing closing paren for a dictionary_expr that has a semantic expression 2018-05-03 11:44:50 -07:00
Doug Gregor
3e2bed119b [AST] Switch SpecializedProtocolConformance over to SubstitutionMap.
Eliminate another common use of SubstitutionList from the AST.
2018-05-02 13:38:15 -07:00
Doug Gregor
192234415d [AST] Store SubstitutionMaps in ConcreteDeclRef and Witness data structures.
Replace two prominent uses of SubstitutionList, in ConcreteDeclRef and
Witness, with SubstitutionMap. Deal with the myriad places where we
now have substitution maps and need substitution lists (or vice versa)
caused by this change.

Overall, removes ~50 explicit uses of SubstitutionList (of ~400).
2018-05-02 13:38:14 -07:00
Doug Gregor
6ca3f7a065 [AST] Don’t deserialize in ProtocolConformance::dump(). 2018-04-10 21:17:10 -07:00
Jordan Rose
701975ad1d Add parsing support for @unknown (SE-0192)
This is our first statement attribute, made more complicated by the
fact that a 'case'/'default' isn't really a normal statement. I've
chosen /not/ to implement a general statement attribute logic like we
have for types and decls at this time, but I did get the compiler
parsing arbitrary attributes before 'case' and 'default'. As a bonus,
we now treat all cases within functions as being switch-like rather
than enum-like, which is better for recovery when not in a switch.
2018-04-05 16:35:14 -07:00
Doug Gregor
b2b69e8abf Rename BoundNameAliasType to NameAliasType.
NameAliasType is dead! Long live NameAliasType!
2018-03-25 21:35:17 -07:00
Doug Gregor
c43f96a855 [AST] Remove now-unused NameAliasType. 2018-03-25 21:35:16 -07:00
Doug Gregor
80eae200b6 [AST] Preserve type sugar for generic typealiases
Introduce a new Type node, BoundNameAliasType, which describes a
reference to a typealias that requires substitutions to produce the
underlying type. This new type node is used both for references to
generic typealiases and for references to (non-generic) typealiases
that occur within generic contexts, e.g., Array<Int>.Element.

At present, the new type node is mainly useful in preserving type
sugar for diagnostics purposes, as well as being reflected in other
tools (indexing, code completion, etc.). The intent is to completely
replace NameAliasType in the future.
2018-03-21 23:49:17 -07:00
Jordan Rose
9034ba617b Ban @_fixed_layout on enums in favor of @_frozen
In theory there could be a "fixed-layout" enum that's not exhaustive
but promises not to add any more cases with payloads, but we don't
need that distinction today.

(Note that @objc enums are still "fixed-layout" in the actual sense of
"having a compile-time known layout". There's just no special way to
spell that.)
2018-03-20 14:49:10 -07:00
Mark Lacey
b4e854e9c1 Change OptionalSomePattern to print in a manner consistent with other patterns. 2018-03-13 16:40:35 -07:00
Huon Wilson
e307e54098 [AST] Explicitly track things marked __owned. 2018-03-08 12:36:24 +11:00
Mark Lacey
7db5721dc7 Add ConstraintSystem::dump(Expr *).
Add dumpers to dump from the constraint system type cache.

There isn't a TypeLoc dumper per-se, but the places where we dump
TypeLocs in expression dumping will read the type from the cache.
2018-02-15 15:21:28 -08:00
Mark Lacey
fdd86fe069 Remove ImplicitlyUnwrappedOptionalType.
We haven't been creating these since
https://github.com/apple/swift/pull/14299 but there was more
groundwork before we could actually remove the type definition.
2018-02-05 23:59:01 -08:00
Harlan
5e02d2a877 Implement #warning and #error (#14048)
* Implement #warning and #error

* Fix #warning/#error in switch statements

* Fix AST printing for #warning/#error

* Add to test case

* Add extra handling to ParseDeclPoundDiagnostic

* fix dumping

* Consume the right paren even in the failure case

* Diagnose extra tokens on the same line after a diagnostic directive
2018-02-03 18:07:05 -05:00
John McCall
52bb547a7e Merge pull request #13866 from rjmccall/accessor-decl
Split AccessorDecl out from FuncDecl.  NFC.
2018-01-12 17:02:35 -05:00
John McCall
7f0f8830cd Split AccessorDecl out from FuncDecl. NFC.
This has three principal advantages:

- It gives some additional type-safety when working
  with known accessors.

- It makes it significantly easier to test whether a declaration
  is an accessor and encourages the use of a common idiom.

- It saves a small amount of memory in both FuncDecl and its
  serialized form.
2018-01-12 14:20:27 -05:00
Slava Pestov
9ff97367df AST: Rename hasFixedLayout() to isResilient() and flip polarity
In IRGen we call this isResilient() already in IRGen, and it's
more consistent to call it the same thing everywhere.
2018-01-11 21:57:42 -08:00