Slava Pestov
00cb08d9b3
Parse: Only diagnose renamed @_inlineable and @_versioned in -swift-version 4.2
...
Normally we don't gate *warnings* on -swift-version flags, but
SwiftNIO makes use of @_inlineable / @_versioned and wants to
continue building with Swift 4.1 until 4.2 is released.
Fixes <https://bugs.swift.org/browse/SR-7578 >,
<rdar://problem/40717640>.
2018-06-09 22:41:54 -07:00
enomoto
bfff091fa8
Fix error message for a subscript without accessors says "computed property"
2018-06-08 20:45:05 -07:00
Mox Soini
965124708a
Better error message for 'class func/var' usage in protocols
2018-06-04 08:49:28 +03:00
Rintaro Ishizaki
7c4aaef4f5
[CodeCompletion] Disable completion for declaration name position ( #16898 )
...
Code completion should not suggest anything when declaring a new name.
rdar://problem/29392238
2018-05-30 12:29:58 -07:00
Alex Hoppen
9d3233c556
[incrParse] Allow reuse of MemberDeclListItems
2018-05-22 08:52:38 -07:00
Alex Hoppen
b904194998
[libSyntax] Add support for parsing #sourceLocation directives
2018-05-22 08:52:31 -07:00
Wesley Wickwire
9e8f8d9acb
centralized it a little better
2018-05-15 00:16:49 -04:00
Wesley Wickwire
d0c1fd6e72
added suggestion for inlinable misspelling
2018-05-14 23:53:10 -04:00
Rintaro Ishizaki
a6f7a8ea35
[Parser] Set local discriminator to ParamDecls
...
We have to discriminate between params and local variables.
2018-05-11 15:37:40 +09:00
Rintaro Ishizaki
df10afd1a2
[Parse] Discriminate local variables
...
Set local discriminator for all local `VarDecl`s. Otherwise, they cannot
be discriminated with USRs. This change is needed for rename refactoring which
uses USR for discrimiating variable names.
https://bugs.swift.org/browse/SR-7205 ,
rdar://problem/34701880
2018-05-11 15:34:42 +09:00
Pavel Yaskevich
adfaf8bab4
Merge pull request #16394 from xedin/rdar-39909829
...
[Parser] Set decl context to be typealias when completing its underly…
2018-05-07 14:14:37 -07:00
Kazutaka Homma
cfc91fd7b3
[SR-6996]Better diagnostic when declaring a class inheritance with parentheses ( #15010 )
...
add diagnosis for python style inheritance clause
2018-05-07 13:27:08 +09:00
Pavel Yaskevich
f49aad16b7
[Parser] Set decl context to be typealias when completing its underlying type
...
Parser didn't capture correct context when code completion
was attempted on typealias' right-hand side which, if there are
generic parameters present, would result in a crash. These
changes make it so completion gets a correct declaration
context in aforementioned case and typealias declaration is marked
invalid because it doesn't have a proper type.
Resolves: rdar://problem/39909829
2018-05-04 17:39:55 -07:00
Alex Hoppen
4c1b27db83
[libSyntax] Fix parsing of delayed function bodies
2018-04-27 21:05:36 -07:00
Alex Hoppen
82df80ad9d
[libSyntax] Allow declarations with external asm name to not have a body
...
This covers declarations of functions with the @_silgen_name attribute
used in the stdlib.
2018-04-27 21:03:19 -07:00
Alex Hoppen
05350cd0bb
[libSyntax] Fix parsing of delayed function bodies
2018-04-27 08:10:19 -07:00
Alex Hoppen
94b8a3545b
[libSyntax] Fix parsing for KeyPath
2018-04-25 13:30:31 -07:00
Alex Hoppen
28973f23b6
[libSyntax] Fix parsing of member declarations with trailing semicolon
2018-04-24 14:19:24 -07:00
Alex Hoppen
c6a11097e8
[libSyntax] Fix parsing of #if inside type declarations
2018-04-24 14:16:11 -07:00
Alex Hoppen
3e9ae802c2
[libSyntax] Make parsing of attribute arguments more structured
...
This also fixes several issues where attribute arguments could not be
parsed as a TokenList since some of its arguments already had structure
and were not tokens
2018-04-24 13:18:15 -07:00
Alex Hoppen
75406c895c
[libSyntax] Enable parsing of class restrictions for protocols
2018-04-23 12:23:27 -07:00
Rintaro Ishizaki
f1202c4563
Merge pull request #15891 from rintaro/syntax-operator-selector
...
[Syntax] Parse 'operator' decl and '#selector' expr syntax.
2018-04-13 15:45:43 +09:00
Rintaro Ishizaki
203496f048
[Parse] Hoist diagnostics for named 'subscript'/'init'
...
Mainly for code readability.
2018-04-13 11:58:33 +09:00
Rintaro Ishizaki
eb69497d64
[Syntax] Parse 'operator' declaration syntax
2018-04-12 13:55:55 +09:00
Rintaro Ishizaki
b457500389
[Syntax] Parse 'precedencegroup' declaration syntax
2018-04-11 23:21:54 +09:00
Jordan Rose
6d30272bfd
Merge pull request #14382 from jrose-apple/unknown-case
...
Implementation for `@unknown default`
2018-04-10 11:19:53 -07:00
David Zarzycki
7174d14dad
[Parsing] NFC: metaprogram contextual decl keywords into Attr.def
2018-04-07 18:00:12 -04: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
Sho Ikeda
63d5d0994a
[ParseDecl] Fix typo in comment
...
dyntamic -> dynamic
2018-04-05 13:32:28 +09:00
Rintaro Ishizaki
6d402888ad
[Parse] Don't swallow 'try' at declaration member position ( #15733 )
...
Previously, this used to be accepted:
class Foo {
try func bar() { }
}
2018-04-05 07:59:53 +09:00
Rintaro Ishizaki
66d400eb1b
[Syntax] Parse 'enum' and 'case' declaration ( #15704 )
2018-04-04 08:38:08 +09:00
Rintaro Ishizaki
2e14337e4a
[Parse] Don't allow attributed #errror/#warning ( #15705 )
2018-04-04 08:36:18 +09:00
Rintaro Ishizaki
18b28b9184
[Parse] Factor out declaration modifier list parsing ( #15702 )
2018-04-03 19:58:57 +09:00
Slava Pestov
f7697291df
Parse: Backward compatibility for old spellings @_inlineable and @_versioned
...
Just parse these as @inlinable and @versioned, then emit a warning
(Swift 4.2 and below) or error (Swift 5).
2018-03-30 21:55:31 -07:00
Slava Pestov
d3e32388c5
Parse: Better error recovery from invalid attributes
2018-03-30 21:55:30 -07:00
Robert Widmann
03580d2fe5
Add a parameter list to EnumElementDecl
...
This models, but does not plumb through, default arguments.
2018-03-28 00:05:56 -04:00
Slava Pestov
34fd4ae512
AST: Use DeclBaseName::Kind::Constructor
...
Fixes <rdar://problem/35852727>, <https://bugs.swift.org/browse/SR-1660 >,
<https://bugs.swift.org/browse/SR-6557 >.
2018-03-16 00:25:56 -07:00
Huon Wilson
b1115af1eb
Switch a pile of VarDecl::Specifier::Owneds to ::Default.
...
A lot of these probably should be Owned, but deciding that is work for
another time.
2018-03-08 12:36:37 +11:00
Huon Wilson
e307e54098
[AST] Explicitly track things marked __owned.
2018-03-08 12:36:24 +11:00
Slava Pestov
6065168928
Parse: Test that we only parse function bodies in primary files
...
I added this optimization a while ago but didn't add a test for it.
2018-03-06 19:42:43 -08:00
Arnold Schwaighofer
390ba419fc
Add an effects(releasenone) function effects attribute
...
A ``@effects(releasenone)`` function might read/write global state but does not
perform a release.
2018-03-05 07:03:54 -08:00
Huon Wilson
b94c5364f5
[NFC] Rename 'Ownership' to 'ReferenceOwnership'.
...
There's really two forms of ownership: references and values. Renaming
to make way for better distinguishing of the two.
2018-03-02 11:38:28 -08:00
Joe Groff
d365c153d4
SIL: Introduce sil_property declarations for property descriptors.
...
This provides SILGen a place to generate the key path component information for an exported property so that it can be linked to from other modules.
2018-02-23 14:57:45 -08:00
Rintaro Ishizaki
6c0af2a24f
[Syntax] Introduce CodeBlockItem ( #14458 )
...
CodeBlockItem represents Decl, Stmt or Expr that optionally followed by
semi-colon.
SourceFile syntax holds a list of CodeBlockItem.
2018-02-08 10:31:01 +09:00
Rintaro Ishizaki
ba58a2994d
[Syntax] Parse associatedtype declaration
...
Also, added generic where clause to typealias declaration.
2018-02-06 09:33:12 +09:00
Rintaro Ishizaki
62eb27110d
[Syntax] Parse 'init', 'deinit' and 'subscript' decl syntax
2018-02-05 19:15:46 +09: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
Rintaro Ishizaki
2134f9f768
[Parse] Move SyntaxParsingContext to Parse ( #14360 )
...
This is only for the Parser.
Also, this resolves layering violation where libAST and libSyntax
depends on each other.
2018-02-03 10:43:52 +09:00
Mark Lacey
305a7eb87d
IUO: Set the IUO attribute on ParamDecls for accessors arguments.
...
Add tests to show that for setter, getter, willSet, didSet,
and subscript setter we successfully implicitly unwrap this argument.
2018-01-27 17:22:33 -08:00
Jordan Rose
3f4cba25d4
Use a semantic ClangImporterSynthesizedTypeAttr for error structs
...
...rather than the ad hoc CustomTypeNameManglingAttr I was using
before. As John pointed out, the AST should be semantic wherever
possible.
We may someday want to get out of this being an attribute altogether,
or duplicating information that's available in the original Clang
node, by actually storing a reference to that node somewhere. This is
tricky and mixed up with deciding what hasClangNode() or
getClangDecl() would mean, though, so for now the attribute just
carries the information we need.
2018-01-24 10:57:52 -08:00