Commit Graph

13 Commits

Author SHA1 Message Date
Hamish Knight
2d7500eda6 [AST] Remove ParenType
Today ParenType is used:

1. As the type of ParenExpr
2. As the payload type of an unlabeled single
   associated value enum case (and the type of
   ParenPattern).
3. As the type for an `(X)` TypeRepr

For 1, this leads to some odd behavior, e.g the
type of `(5.0 * 5).squareRoot()` is `(Double)`. For
2, we should be checking the arity of the enum case
constructor parameters and the presence of
ParenPattern respectively. Eventually we ought to
consider replacing Paren/TuplePattern with a
PatternList node, similar to ArgumentList.

3 is one case where it could be argued that there's
some utility in preserving the sugar of the type
that the user wrote. However it's really not clear
to me that this is particularly desirable since a
bunch of diagnostic logic is already stripping
ParenTypes. In cases where we care about how the
type was written in source, we really ought to be
consulting the TypeRepr.
2024-10-31 11:32:40 +00:00
Kavon Farvardin
5230b19ef6 Test: replace '@_moveOnly' with '~Copyable' 2024-07-23 11:05:33 -07:00
Doug Gregor
27a1baf6f9 Disable new diagnostic formatter for a few tests I missed 2024-02-19 07:43:58 -10:00
Rajveer
48847da5e6 Added the expression cases of the form 'visit...Expr()'
Part of Issue #61601
2024-02-02 13:51:37 +05:30
Anthony Latsis
3f629315a9 Merge pull request #65731 from AnthonyLatsis/always-print-any
ASTPrinter: Turn on explicit `any` printing for everything and remove the option to disable it
2023-05-16 03:27:36 +03:00
Anthony Latsis
7f6d3bcd41 ASTPrinter: Turn on explicit any printing for everything and remove the option to disable it 2023-05-13 02:55:49 +03:00
Kavon Farvardin
3e4bc82aa8 rename _forget to discard; deprecate _forget
SE-390 concluded with choosing the keyword discard rather than forget for
the statement that disables the deinit of a noncopyable type. This commit
adds parsing support for `discard self` and adds a deprecation warning for
`_forget self`.

rdar://108859077
2023-05-08 21:42:19 -07:00
Kavon Farvardin
4943beb35e emit error if _forget is used on a type with no deinit
rdar://108877261
2023-05-05 14:50:48 -07:00
Kavon Farvardin
2c7d9a5047 update tests given move-only types are enabled
the main things still left behind the experimental flag(s) are
- move-only classes (guarded by MoveOnlyClasses feature)
- noimplicitcopy
- the _borrow operator
2023-03-14 18:35:13 -07:00
Kavon Farvardin
8559d3c6ea fix issue printing the forget statement in the AST
`kw_forget` isn't covered by `operator<<` since it's
not a normal keyword.
2023-02-28 23:31:34 -08:00
Louis D'hauwe
7ebdb8e6b4 [ASTPrinter] Fix expression printing for metatype access
And fix operators not printing when we can't get a `MemberOperatorRef`.
2022-02-02 12:43:22 -08:00
Louis D'hauwe
9da37466ea [ASTPrinter] More expression printing 2022-01-11 14:24:17 -08:00
Louis D'hauwe
a89ea380a9 [ASTPrinter] Print expressions
Add new `-print-ast-decl` frontend option for only printing declarations,
to match existing behavior.
Some tests want to print the AST, but don't care about expressions.

The existing `-print-ast` option now prints function bodies and expressions.
Not all expressions are printed yet, but most common ones are.
2022-01-11 14:24:16 -08:00