Commit Graph

6321 Commits

Author SHA1 Message Date
Robert Widmann
aa82a857f0 Merge pull request #41848 from CodaFi/parse-tial-credit 2022-03-17 15:35:11 -07:00
Robert Widmann
cc0bc22dcb Correct The Parsing of Primary Associated Type Clauses in Protocols
The prior syntax tree did not take into account that the clause itself should own the angle brackets.
2022-03-16 17:28:45 -07:00
Cal Stephens
14076df392 Fix test failures 2022-03-16 16:08:26 -07:00
Robert Widmann
363954a416 Put Variadic Generics Behind a Flag 2022-03-16 14:22:03 -07:00
Alex Hoppen
e40fc772c1 Merge pull request #41667 from ahoppen/pr/complete-expr-after-if
[CodeCompletion] Complete code completion tokens after if-statement as top-level
2022-03-16 15:07:27 +01:00
Alex Hoppen
7a1792ab4e [Parser] Support 'any' type in SwiftSyntax
Previously, SwiftSyntax wasn’t able to parse 'any' types. Add support for them now.

rdar://90077430
2022-03-15 10:52:05 +01:00
Alex Hoppen
82cb46c8b0 [CodeCompletion] Complete code completion tokens after if-statement as top-level
Instead of setting the code completion position when parsing the if-statement, which doesn’t create a `CodeCompletionExpr`, parse it as a new top-level expression.

As far as test-cases are concerned, this removes the “RareKeyword” flair from top-level completions in the modified test case. This makes sense IMO.
2022-03-14 14:40:11 +01:00
Cal Stephens
ac7529f5bd Improve diagnostic in cases like 'if let foo.bar' 2022-03-13 12:20:01 -07:00
Konrad `ktoso` Malawski
13cc8b3157 [Distributed] Enable no-longer-experimental distributed by default 2022-03-11 22:14:49 +09:00
Allan Shortlidge
b29251219a Parse: Add availability macro support to @_backDeploy attribute parsing. Consolidate parsing code shared between @_originallyDefinedIn and @_backDeploy. 2022-03-08 14:13:10 -08:00
Evan Wilde
b9bdaed242 Merge pull request #41688 from etcwilde/ewilde/replace-await-with-async
Fix await in effect with async
2022-03-08 10:47:41 -08:00
Xi Ge
3ca3e05377 Share string literal for spi_available attribute name 2022-03-05 19:23:00 -08:00
Evan Wilde
69cb29e758 Fix await in effect with async
Typing `func foo() await {` is something that folks do from time-to-time.
The old error message was unintuitive and suggested adding a semicolon
between the parenthesis and the await, then proceeded to complain about
the opening brace. This wasn't very clear about what the error actually
was.

Pulling this in line with `try`, `throw`, and `throws`, this patch
suggests replacing `await` with `async` when in the function effect
position, and provides a nice fix-it.
2022-03-05 15:53:17 -08:00
Xi Ge
ce07ce2dbc frontend: add basic support for @_spi_available 2022-03-04 21:26:56 -08:00
Slava Pestov
a013cd2076 AST: Replace PrimaryAssociatedTypeAttr with AssociatedTypeDecl::isPrimary() flag 2022-03-03 10:15:02 -05:00
Slava Pestov
7dfc2a20fb Parse: New syntax for primary associated types 2022-03-03 00:08:00 -05:00
Hamish Knight
77cb08d767 [Parse] Better recover from regex error
Instead of returning a parser error, which results
in generic parser recovery that skips until the
next decl, return an `ErrorExpr` so we can
continue parsing.
2022-03-01 16:05:39 +00:00
Hamish Knight
611fd33f58 Update regex literal delimiters
Update the lexing code for the replacement of the
`'/.../'` and `'|...|'` delimiters with `#/.../#`
and `#|...|#` respectively, in addition to
allowing the `re'...'` delimiter.
2022-02-24 17:37:16 -08:00
Allan Shortlidge
24613134de SILGen: Add a SILGen test for the @_backDeploy attribute and fix parsing for the attribute so that -verify-syntax-tree passes. The SILGen test doesn't verify anything special yet since we're not emitting thunks yet at call sites. 2022-02-11 14:47:48 -08:00
Allan Shortlidge
ebfb94e710 Parse: Refactor platform version tuple list parsing for @_backDeploy into a separate function and improve diagnostics. 2022-02-08 10:36:41 -08:00
Allan Shortlidge
b860e762b2 AST: Introduce the @_backDeploy function attribute:
- Parse the attribute and diagnose parsing issues
- Serialize the attribute
2022-02-08 10:11:04 -08:00
Doug Gregor
45e64e45ef Merge pull request #40680 from DougGregor/preconcurrency-attr 2022-01-27 16:48:11 -08:00
Doug Gregor
05f2c4954a Merge pull request #40993 from DougGregor/opaque-parameters
Opaque parameters
2022-01-27 09:19:26 -08:00
Holly Borla
65f6ea3c91 Merge pull request #41023 from hborla/fix-any-expr-parsing
[Parser] Don't parse 'any identifier' as a type when the identifier is on the next line.
2022-01-26 20:28:46 -08:00
Doug Gregor
0416ec708b Augment GenericTypeParamDecl with bits indicating they came from opaque types 2022-01-26 14:47:11 -08:00
Holly Borla
1acc9c3798 [Parser] Don't parse 'any identifier' as a type when the identifier
appears on the next line.
2022-01-26 11:06:28 -08:00
Doug Gregor
7149702d12 Rename @_predatesConcurrency to @preconcurrency.
Introduce the `@preconcurrency` attribute name for `@_predatesConcurrency`,
which has been the favored name in the pitch thread so far. Retain the
old name for now to help smooth migration.
2022-01-26 08:39:01 -08:00
Erik Eckstein
beb2bd2a96 AST: support @_effects attribute with custom strings.
In addition to the predefined cases,  like "readnone", "readonly", etc. support providing a custom string, which will be parsed later.
Also, allow multiple effects attributes to be put onto a function.
2022-01-25 11:29:23 +01:00
Erik Eckstein
5fd941eb67 Add the @exclusivity attribute.
The `@exclusivity(unchecked)` attribute can be used on variables to selectively disable exclusivity checking.
For completeness, also the `@exclusivity(checked)` variant is supported: it turns on exclusivity checking for specific variables if exclusivity enforcement is disabled by the command line option.

This new attribute is a missing implementation part of SE-0176 (https://github.com/apple/swift-evolution/blob/main/proposals/0176-enforce-exclusive-access-to-memory.md).

rdar://31121356
2022-01-25 08:06:45 +01:00
Anthony Latsis
c8ed597bf1 Merge pull request #40953 from AnthonyLatsis/any-aint-some
Parse: Fix accidental parsing of ExistentialTypeRepr as OpaqueReturnTypeRepr and vice versa
2022-01-22 11:57:36 +03:00
Holly Borla
1bf9f4217b Merge pull request #40949 from hborla/parse-any-type-expr
[Parser] Parse `(any P).self`
2022-01-21 14:46:41 -08:00
Anthony Latsis
52de904ad2 Parse: Fix accidental parsing of ExistentialTypeRepr as OpaqueReturnTypeRepr and vice versa 2022-01-21 18:13:44 +03:00
Holly Borla
bee6adf605 [Parser] Parse (any P).self 2022-01-20 21:49:56 -08:00
Angela Laar
54a738b0bb Merge branch 'main' into smooth_operator 2022-01-20 12:17:09 -08:00
Angela Laar
3eb2b1c67b Fix error definition 2022-01-13 13:53:50 -08:00
Angela Laar
68ec09b7e2 [Parser] Check for postfix operator in import paths
Add diagnostic and remove operator from path
Fixes rdar://87159294
2022-01-12 18:18:16 -08:00
swift-ci
9412bce204 Merge remote-tracking branch 'origin/main' into rebranch 2022-01-11 04:34:18 -08:00
Luciano Almeida
91966deeb7 Merge pull request #40705 from LucianoPAlmeida/SR-15657-diag-enum-cp
[Sema] Avoid misleading diagnostics for incomplete enum computed properties
2022-01-11 09:25:19 -03:00
swift-ci
2031e5fe11 Merge remote-tracking branch 'origin/main' into rebranch 2022-01-04 20:54:34 -08:00
Doug Gregor
43324e8130 Merge pull request #40710 from DougGregor/structural-opaque-result-types 2022-01-04 20:51:14 -08:00
LucianoAlmeida
29879ea822 [Parser] Improving wording for invalid empty computed properties and subscripts 2022-01-04 23:46:09 -03:00
swift-ci
95586e858c Merge remote-tracking branch 'origin/main' into rebranch 2022-01-04 16:00:29 -08:00
Cal Stephens
b9c2370b1b Implement support for 'if let foo {' syntax 2022-01-04 09:36:20 -08:00
ApolloZhu
683d469fcd Extends canImport to check for submodule availability 2021-12-28 22:54:47 -08:00
Doug Gregor
b2aa85183d Use TypeRepr::hasOpaque() consistently.
Replace shallow checks for `OpaqueReturnTypeRepr` with calls to
`hasOpaque`, which ensures that we consider opaque result types in
structural positions.
2021-12-27 20:11:40 -08:00
swift-ci
20187ed5e1 Merge remote-tracking branch 'origin/main' into rebranch 2021-12-22 14:52:56 -08:00
Richard Wei
6645f0d33f Merge pull request #40630 from rxwei/capture-inference 2021-12-22 14:44:34 -08:00
swift-ci
0b1f353916 Merge remote-tracking branch 'origin/main' into rebranch 2021-12-22 08:33:29 -08:00
Evan Wilde
319672d084 Merge pull request #40668 from etcwilde/ewilde/an-actor-for-your-thoughts
Fix miss-parse diagnostic to say "actor"
2021-12-22 08:16:59 -08:00
swift-ci
da1ab99326 Merge remote-tracking branch 'origin/main' into rebranch 2021-12-22 05:56:01 -08:00