Commit Graph

2431 Commits

Author SHA1 Message Date
Adrian Prantl
ff63eaea6f Remove \brief commands from doxygen comments.
We've been running doxygen with the autobrief option for a couple of
years now. This makes the \brief markers into our comments
redundant. Since they are a visual distraction and we don't want to
encourage more \brief markers in new code either, this patch removes
them all.

Patch produced by

      for i in $(git grep -l '\\brief'); do perl -pi -e 's/\\brief //g' $i & done
2018-12-04 15:45:04 -08:00
Brent Royal-Gordon
facaad1873 A diagnosis from the argument clinic (#20997)
[Parse] Warn if the same argument is specified more than once in @available
2018-12-04 01:05:09 -08:00
Harlan Haskins
dd163f0701 [Parse] Parse @_hasStorage attribute outside of SIL 2018-11-26 18:42:02 -08:00
Harlan Haskins
66a61c5eca Rename @sil_stored to @_hasStorage 2018-11-12 11:32:32 -08:00
Pavel Yaskevich
53417f4aba [AST] Propagate @autoclosure flag to parameter decl and type flags 2018-11-10 11:59:28 -08:00
Slava Pestov
c7338d06ca AST: Remove owning addressors 2018-11-09 20:49:44 -05:00
Arnold Schwaighofer
c83f63855b Merge pull request #20428 from aschwaighofer/private_imports
Add @_private(from: "SourceFile.swift") imports
2018-11-09 07:18:25 -08:00
Arnold Schwaighofer
fbb4236eb3 Adjust to upstream change 2018-11-09 04:56:24 -08:00
Arnold Schwaighofer
e4f4dfcf84 Address feedback 2018-11-08 11:13:42 -08:00
Arnold Schwaighofer
963c64e3e7 Add @_private(from: "SourceFile.swift") imports
A module compiled with `-enable-private-imports` allows other modules to
import private declarations if the importing source file uses an
``@_private(from: "SourceFile.swift") import statement.

rdar://29318654
2018-11-08 08:00:47 -08:00
Marc Rasi
bf18697b4f parsing, typechecking, and SILGen for #assert
`#assert` is a new static assertion statement that will let us write
tests for the new constant evaluation infrastructure that we are working
on. `#assert` works by lowering to a `Builtin.poundAssert` SIL
instruction. The constant evaluation infrastructure will look for these
SIL instructions, const-evaluate their conditions, and emit errors if
the conditions are non-constant or false.

This commit implements parsing, typechecking and SILGen for `#assert`.
2018-11-07 16:34:17 -08:00
Arnold Schwaighofer
6f86e5c703 Fix unused variable warning. 2018-11-07 14:14:54 -08:00
Arnold Schwaighofer
b102c7f6b4 Parser/Sema/SILGen changes for @_dynamicReplacement(for:)
Dynamic replacements are currently written in extensions as

extension ExtendedType {
  @_dynamicReplacement(for: replacedFun())
  func replacement() { }
}

The runtime implementation allows an implementation in the future where
dynamic replacements are gather in a scope and can be dynamically
enabled and disabled.

For example:

dynamic_extension_scope CollectionOfReplacements {
  extension ExtentedType {
    func replacedFun() {}
  }

  extension ExtentedType2 {
    func replacedFun() {}
  }
}

CollectionOfReplacements.enable()
CollectionOfReplacements.disable()
2018-11-06 09:58:36 -08:00
Arnold Schwaighofer
c158106329 Allow dynamic without @objc in -swift-version 5
Dynamic functions will allow replacement of their implementation at
runtime.
2018-11-06 09:53:21 -08:00
Rintaro Ishizaki
90fe0a7e86 [CodeCompletion] Implement completion for 'get', 'set', 'willSet', 'didSet'
Implement 'get', 'set', 'willSet', 'didSet' completion at the beginning
of accessor position.

  var value: Ty {
    <HERE> // 'get', 'set', 'willSet' and 'didSet' along with normal
           // completion.
  }

  var value: Ty {
    get { return ... }
    <HERE> // 'get', 'set', 'willSet' and 'didSet' only.
  }

rdar://problem/20957182
2018-10-19 14:28:56 +09:00
Rintaro Ishizaki
797761adae [CodeCompletion] Try to parse complete expression after CC token
Type may depend on its suffix. Parsing complete expression including its
suffix improves context type info around the CC token.

rdar://problem/44143964
2018-10-16 06:08:29 +09:00
Mark Lacey
5e0cb1978a Fix libSyntax support for operator decl designated types. 2018-10-11 13:36:14 -07:00
Mark Lacey
cb5fd7f8d7 Merge branch 'master' into extend-operator-designated-type 2018-10-11 07:51:23 -07:00
Mark Lacey
703341239b Add support for multiple designated types for an operator declaration.
Add parsing, type checking, serialization, and deserialization support
for specifying multiple types as "designated" for operator lookup for
a given operator declaration.

The constraint solver still considers only the first type when
deciding the order to attempt the elements of a disjunction, so this
doesn't really change behavior yet.
2018-10-09 23:54:01 -07:00
Mark Lacey
e2529703ab Change operator decl representation for designated type.
Update the representation to allow for multiple types to be specified
for a single operator.

No parsing, serialization, or deserialization support yet, so NFC.
2018-10-09 23:17:15 -07:00
Anthony Latsis
f2ff87e652 Merge branch 'master' into code-compl-precedencegroups 2018-10-09 18:08:16 +03:00
Mark Lacey
36284ba377 Extend operator decls to allow any designated nominal type for lookup.
Rather than limiting this to protocols, allow any nominal type.

Rename -enable-operator-designated-protocols to
-enable-operator-designated-types to reflect the change.
2018-10-06 17:02:31 -07:00
Jordan Rose
73d5ebaad2 Rename "textual interface" to "parseable interface" (#19713)
We already have something called "module interfaces" -- it's the
generated interface view that you can see in Xcode, the interface
that's meant for developers using a library. Of course, that's also a
textual format. To reduce confusion, rename the new module stability
feature to "parseable [module] interfaces".
2018-10-04 17:49:55 -07:00
MIZUNO Hiroki
f2bdce8251 [SR-8340]Improve fix-it for var and subscript in Protocol (#19660)
* [Parser] Improve fix-it for subscription in protocol
* [Sema] Add fix-it for property in protocol

https://bugs.swift.org/browse/SR-8340
2018-10-05 07:50:03 +09:00
fischertony
46dc36536c [Gardening] Typo and indentation fixes 2018-10-03 22:12:51 +03:00
fischertony
e505d417fa [Parse][CodeCompletion] Completions for precedencegroup decls
Added the 'Module::getPrecedenceGroups' API to separate precedence group lookup
from 'Module::lookupVisibleDecls', which together with 'FileUnit::lookupVisibleDecls',
to which the former is forwarded, are expected to look up only 'ValueDecl'. In particular, this
prevents completions like Module.PrecedenceGroup.
2018-10-03 22:12:20 +03:00
John Holdsworth
eb450ee494 Fix minor bug in #sourceLocation on lex error (#19344)
Fix a minor bug in the implementation of #sourceLocation when the
directive is succeeded by token that gives an error during lexing.
The error will be reported with the wrong location. This is because
lexing of the next token occurs immediately on consuming the last
token of the directive which is before the virtual file is set up to have
the location take effect.

Resolved by moving consumption of directives last token to the end
of the function.
2018-09-19 11:03:08 +09:00
Harlan
665db876ea [InterfaceGen] Print bodies of inlinable functions in textual interfaces (#19224)
* Introduce stored inlinable function bodies

* Remove serialization changes

* [InterfaceGen] Print inlinable function bodies

* Clean up a little bit and add test

* Undo changes to InlinableText

* Add serialization and deserialization for inlinable body text

* Allow parser to parse accessor bodies in interfaces

* Fix some tests

* Fix remaining tests

* Add tests for usableFromInline decls

* Add comments

* Clean up function body printing throughout

* Add tests for subscripts

* Remove comment about subscript inlinable text

* Address some comments

* Handle lack of @objc on Linux
2018-09-14 10:23:15 -07:00
John Holdsworth
e55d4254d2 [Parse] Allow multiline attribute messages (SE-200) (#19219)
Multiline string literal at attribute message position was disallowed in
59778f8ecb.

Reworked to try to at least get multiline strings working which might be
useful as messages for attributes (for example a detailed “unavailable”
annotation) minus the code which read off the start of the StringRef buffer.
2018-09-14 10:33:32 +09:00
Xi Ge
033732b1e5 ASTVerifier: avoid verifying IterableDeclContext if it has unparsed members. 2018-09-12 14:11:41 -07:00
Xi Ge
7fbd10f170 Parser: disable delayed member decl parsing when parsing SIL. 2018-09-12 12:42:41 -07:00
Xi Ge
0a03259f4a Parser: disable lexer diagnostics during delayed parsing.
The lexer diagnostics have already been emitted during token skipping.
2018-09-11 16:30:57 -07:00
Xi Ge
b02c7b15a3 parser: on demand parsing of protocol decl members. 2018-09-11 16:30:57 -07:00
Xi Ge
1798317d13 parser: on demand parsing of struct decl members. 2018-09-11 16:19:55 -07:00
Xi Ge
8cac5530b1 parser: on demand parsing of class decl members. 2018-09-11 16:19:55 -07:00
Xi Ge
549bf5d48c Parser: rename canDelayBodyParsing to canDelayMemberDeclParsing. NFC 2018-09-10 15:21:01 -07:00
Xi Ge
1b53a3c34e Parser: disallow delayed decl member parsing if interface hash is requested.
Calculating interface hash requires tokens being consumed at a deterministic
order; thus we should disable delayed decl member parsing here.
2018-09-10 15:03:44 -07:00
Rintaro Ishizaki
66df646c67 Merge pull request #19206 from rintaro/rdar44228891
[Parse] Disable support for multiline/extended escaping string literal in attribute message
2018-09-11 02:01:32 +09:00
Xi Ge
c4db69451c Parser: Ignore and recover marked parse position during on-demand member parsing.
New construction of a parser instance will reset the marked parser
position in PersistentParserState. We should recover the marked parser
position during on-demand parsing in case the marked position will be
later used to create another parser instance to continue parsing
linearly.
2018-09-09 01:28:20 -07:00
Rintaro Ishizaki
59778f8ecb [Parse] Disable support for multiline/extended escaping string literal
in attribute message

Strings of diagnostics message processed in EncodedDiagnosticMessage
aren't necessarily from parsed Swift source code. That means, they might
not have quotes around it. Furthermore, memory around them might not be
managed. The logic in 'Lexer::getEncodedStringSegment()' used to cause
access violation.

For now, disable multiline string literal and extended escaping in string
literal for attribute message position. Considering the message might be
from Clang, we cannot simply enable this.

rdar://problem/44228891
2018-09-08 17:32:36 +09:00
Harlan
eb75ad80dc [AST] Remove stored TypeLoc from TypedPattern (#19175)
* [AST] Remove stored TypeLoc from TypedPattern

TypedPattern was only using this TypeLoc as a means to a TypeRepr, which
caused it to store the pattern type twice (through the superclass and through
the TypeLoc itself.)

This also fixes a bug where deserializing a TypedPattern doesn't store
the type correctly and generally cleans up TypedPattern initialization.

Resolves rdar://44144435

* Address review comments
2018-09-07 21:14:04 -07:00
Mark Lacey
1e7dae3741 Merge pull request #19145 from rudkx/parse-designated-protocol
Add support for parsing designated protocols in operator declarations.
2018-09-06 22:01:02 -07:00
Xi Ge
0c4ee41c48 Merge pull request #19184 from nkcsgexi/parse-enum
parser: on-demand parsing of the members in enum decls.
2018-09-06 19:35:52 -07:00
Xi Ge
4c7193b999 parser: on-demand parsing of the members in enum decls. 2018-09-06 17:59:09 -07:00
Dante Broggi
9d870e59e5 Fix typo, found by looking through commits. 2018-09-06 20:34:56 -04:00
Xi Ge
7379bc5782 Add counter for parsed decl lists. 2018-09-06 11:44:49 -07:00
Xi Ge
24b0eac9a4 Parser: parse members in extension decls incrementally. 2018-09-05 17:00:39 -07:00
Mark Lacey
039d10b709 Add support for parsing designated protocols in operator declarations.
The support is gated by a frontend option,
-enable-operator-designated-protocols.

This means that in an operator declaration we can declare a protocol
which has one or more requirements specifying this operator. The
operators from that designated protocol will be the first ones we try
when type checking an expression. If we successfully typecheck using
the operators specified in that protocol, we do not attempt any other
overloads of the same operator.

This makes it possible to dramatically speed up successful
typechecking.
2018-09-05 11:58:43 -07:00
Davide Italiano
1289b49615 [Parse] Store local typealiases, they matter for type reconstruction.
Fixes <rdar://problem/42446693>

(Thanks to Jordan for pointing out the solution)
2018-09-04 17:00:01 -07:00
Jordan Rose
78560c7aa8 Merge pull request #18895 from dingobye/sr8598
[Parser] Improve diagnostics for special platforms in available attribute.
2018-08-31 17:24:40 -07:00