Commit Graph

3981 Commits

Author SHA1 Message Date
Ben Barham
b4fb7d019a [IDE] Skip visiting constructor references when the decl is unknown
Have left in an assert since it would be nice to get a test case for
when this actually occurs.

Resolves rdar://67412430
2020-08-25 14:15:03 +10:00
swift_jenkins
b1cc1ae5ae Merge remote-tracking branch 'origin/master' into master-rebranch 2020-08-18 18:26:20 -07:00
Anthony Latsis
492156c10f Remove SubscriptDecl::getBodyResultTypeLoc 2020-08-19 00:09:10 +03:00
Anthony Latsis
21faa48298 Remove FuncDecl::getBodyResultTypeLoc 2020-08-19 00:09:10 +03:00
swift_jenkins
9ab003bcf9 Merge remote-tracking branch 'origin/master' into master-rebranch 2020-08-14 15:14:01 -07:00
Rintaro Ishizaki
f4ae514802 Merge pull request #33475 from rintaro/ide-completion-inactiveifconfig-rdar67027408
[CodeCompletion] Parse #if block containing CC token as active
2020-08-14 15:02:09 -07:00
Nathan Hawes
f0c8b8e571 Manually merge remote-tracking branch 'upstream/master' into HEAD
Conflicts:
	include/swift/AST/PrettyStackTrace.h
2020-08-14 11:06:27 -07:00
Rintaro Ishizaki
7198b3bd83 [CodeCompletion] Fast completion is now supported in inactive #if blocks 2020-08-14 10:33:53 -07:00
David Zarzycki
c2fc2108d0 Merge pull request #33448 from davezarzycki/pr33448
[NFC] Fix -Wsuggest-override warnings
2020-08-14 04:46:12 -04:00
swift-ci
670f798134 Merge remote-tracking branch 'origin/master' into master-rebranch 2020-08-13 15:43:17 -07:00
swift-ci
2ef85c1d89 Merge pull request #33397 from bnbarham/benb/multiline-indentation-32181422 2020-08-13 15:39:58 -07:00
swift-ci
cd81069032 Merge remote-tracking branch 'origin/master' into master-rebranch 2020-08-13 13:29:55 -07:00
David Zarzycki
1e940c2c7e [NFC] Fix -Wsuggest-override warnings
LLVM, as of 77e0e9e17daf0865620abcd41f692ab0642367c4, now builds with
-Wsuggest-override. Let's clean up the swift sources rather than disable
the warning locally.
2020-08-13 16:17:46 -04:00
Nathan Hawes
51beab6889 Manually merge remote-tracking branch 'upstream/master' into HEAD
Conflicts:
	test/DebugInfo/modulecache.swift
2020-08-13 11:16:33 -07:00
Ben Barham
77c70e9fe6 [SourceKit/CodeFormat] Indent lines in multi-line strings
When the multi-line string is unterminated, the indentation of a line
will be the same as the first previous line that had contents, unless
that line is the line containing the start quotes. In that case the
indentation will be:
  - the same as the start quote indentation, if the quotes are the only
    contents on the line, or
  - an extra indentation level to the start quote line otherwise

Lines within a terminated multi-line string or lines with content will
only ever be indented if their current indentation is invalid (ie. their
indentation level is less than that of their end quotes).

This rule is to prevent any signficant (and possibly unintended)
whitespace being added to existing strings during a whole file/range
format - Xcode does not remove whitespace from whitespace-only lines by
default. This could be improved if the reformat was sent the actual
range rather than a line at a time. Different indentation could then be
chosen if the range was in fact a single line.

Resolves rdar://32181422
2020-08-13 12:35:57 +10:00
Rintaro Ishizaki
513fed7d8c [CodeCompletion] Enable ASTScope in code completion
* Re-create `ASTScope` for each completion
* Add generic params and where clause scope even without missing body
* Use `getOriginalBodySourceRange()` for `AbstractFunctionBodyScope`
* Source range translations for replaced ranges when finding scopes
* Bypass source range checks when the completion happens in the replaced
  range
* Be lenient with ASTScope / DeclContext mismatch in code completion
2020-08-12 16:36:09 -07:00
Rintaro Ishizaki
8a39c8d9d8 [CodeCompletion Remember the replaced source range in SourceManager 2020-08-12 13:23:30 -07:00
Rintaro Ishizaki
c5a4af37f8 Merge pull request #33421 from rintaro/ast-func-oriignalsourcerange
[AST] Formalize getBodySourceRange() for fast completion
2020-08-12 13:18:43 -07:00
Rintaro Ishizaki
1ab4a4742a [AST] Formalize getBodySourceRange() for fast completion
Fast completion replaces the body ('BraceStmt') of function decls with
other bodies parsed from different source buffers from the original
source buffer. That means the source range of the body and the location
of the function declaration itself might be in different buffers.

Previously, FuncDecl::getSourceRange() used to use the 'func' keyword decl
as the start loc and 'getBodySourceRange().End' as the end loc. This
breaks a SourceRange invariant where the start and end loc must be
in the same buffer.

This patch add a new function 'getOriginalBodySourceRange()' which
always return the source range of the original body of the function. And
use that from 'getSourceRange()' functions.

The orignal body source range is stored in a side table in ASTContext so
that normal compilation doesn't consume space for that extra info.
2020-08-11 17:08:27 -07:00
swift-ci
211b843076 Merge remote-tracking branch 'origin/master' into master-rebranch 2020-08-10 12:03:26 -07:00
AG
05c33330c9 Merge pull request #33370 from bitjammer/acgarland/rdar-65258208-crash-invalid-loc-extracttext
[SymbolGraph] Check Loc validity before extracting text
2020-08-10 11:56:53 -07:00
Ashley Garland
635550cd83 [SymbolGraph] Check Loc validity before extracting text
Hit this crash while walking an `import protocol ...` declaration.
Check loc validity before calling `SourceManager::extractText`:
there is an assertion at the beginning of this function.

rdar://65258208
2020-08-07 13:53:22 -07:00
swift-ci
0dcbd763be Merge remote-tracking branch 'origin/master' into master-rebranch 2020-08-06 15:43:58 -07:00
Nathan Hawes
ef6c374516 [Sema/Index] Resolve #keyPath components so they can be indexed
Unlike \keypath expressions, only the property components of #keypath
expressions were being resolved, so index wouldn't pick up references for their
qualifying types.

Also fixes a code completion bug where it was reporting members from the Swift
rather than ObjC side of bridged types.

Resolves rdar://problem/61573935
2020-08-05 15:27:52 -07:00
swift-ci
0bd029cce2 Merge remote-tracking branch 'origin/master' into master-rebranch 2020-08-05 09:55:55 -07:00
Suyash Srijan
a577a87f99 [ExprContextAnalysis] Look into base type of optional as well when collecting callees for unresolved member (#33292) 2020-08-05 12:54:05 +01:00
swift-ci
ae09b1eb08 Merge remote-tracking branch 'origin/master' into master-rebranch 2020-08-04 18:03:56 -07:00
Rintaro Ishizaki
69d8398b04 Merge pull request #33270 from rintaro/ide-completion-typecheckcontextat
[CodeCompletion] Cleanup typeCheckContextAt()
2020-08-04 15:53:18 -07:00
Rintaro Ishizaki
f97d68f3a7 Merge pull request #33290 from apple/revert-33245-index-key-paths
Revert "[Sema/Index] Resolve #keyPath components so they get handled by indexing, semantic highlighting, etc."
2020-08-04 15:48:09 -07:00
Anthony Latsis
78f0259bfb Merge pull request #33283 from AnthonyLatsis/type-locura-2
ASTWalker: Offload TypeLoc
2020-08-05 00:17:33 +03:00
Nathan Hawes
607e2b8822 Manually merge remote-tracking branch 'upstream/master' into HEAD 2020-08-04 13:47:48 -07:00
Rintaro Ishizaki
00e4a76ef0 Revert "[Sema/Index] Resolve #keyPath components so they get handled by indexing, semantic highlighting, etc." 2020-08-04 12:51:52 -07:00
Robert Widmann
b50a2cf430 Merge pull request #33251 from AnthonyLatsis/type-locura-1
Rid performTypeLocChecking of TypeLoc
2020-08-04 12:04:10 -07:00
Anthony Latsis
7bcc4baa33 [NFC] TypeLoc: Rid performTypeLocChecking off TypeLoc 2020-08-04 19:15:55 +03:00
Anthony Latsis
b26310ee97 TypeLoc: Offload TypeLoc off the ASTWalker 2020-08-04 18:13:28 +03:00
Varun Gandhi
3882beb85d [NFC] Use consistent naming scheme for predicate methods. (#33265)
bool throws() -> isThrowing(), bool async() -> isAsync()
2020-08-03 16:37:29 -07:00
Rintaro Ishizaki
ec8637c197 [CodeCompletion] Cleanup typeCheckContextAt()
There's no need of separate 'Impl' function
2020-08-03 15:31:12 -07:00
Luciano Almeida
2e4d76cc50 Merge pull request #33257 from LucianoPAlmeida/fixme-remove-check
[NFC] Remove empty check for SingleExpression in Refactoring.cpp findConcatenatedExpressions
2020-08-03 18:44:29 -03:00
Nathan Hawes
4c7cd16c3f Merge pull request #33245 from nathawes/index-key-paths
[Sema/Index] Resolve #keyPath components so they get handled by indexing, semantic highlighting, etc.
2020-08-03 10:28:48 -07:00
Luciano Almeida
a31f51d0af [NFC] Remove empty check for SingleExpression in Refactoring.cpp findfindConcatenatedExpressions 2020-08-03 09:43:19 -03:00
Nathan Hawes
1d78fe1211 [Sema/Index] Resolve #keyPath components so they can be indexed
Unlike \keypath expressions, only the property components of #keypath
expressions were being resolved, so index wouldn't pick up references for their
qualifying types.

Also fixes a code completion bug where it was reporting members from the Swift
rather than ObjC side of bridged types.

Resolves rdar://problem/61573935
2020-07-31 17:11:23 -07:00
swift-ci
a0a181159c Merge remote-tracking branch 'origin/master' into master-rebranch 2020-07-31 16:07:19 -07:00
Slava Pestov
09b6b74fa9 Merge pull request #33234 from slavapestov/get-declared-type-cleanup
Replace trivial calls to getDeclaredType() with getDeclaredInterfaceType()
2020-07-31 17:03:31 -04:00
swift-ci
90ddb8b1bf Merge remote-tracking branch 'origin/master' into master-rebranch 2020-07-31 13:42:43 -07:00
Slava Pestov
b4ea644910 IDE: Replace some calls to getDeclaredType() with getDeclaredInterfaceType() 2020-07-31 13:39:02 -04:00
Rintaro Ishizaki
3e558f064f [CodeCompletion] Handle @autoclosure in context type analysis
If the context is '@autoclosure' parameter, the context type should be
the result type of it.

rdar://problem/65802490
2020-07-30 14:58:26 -07:00
swift-ci
bab4706e94 Merge remote-tracking branch 'origin/master' into master-rebranch 2020-07-30 14:03:22 -07:00
Rintaro Ishizaki
facabd8010 Merge pull request #33200 from rintaro/ide-completion-rdar66301353
[CodeCompletion] Fix issue in dependency checking for the editing file
2020-07-30 14:02:03 -07:00
Rintaro Ishizaki
2f4dcf3e2f [CodeCompletion] Fix issue in dependency checking for the editing file
'SM.getCodeCompletionBufferID()' returns the buffer ID of the previous
code completion. 'CI.getCodeCompletionFile()->getBufferID()' always
returns the original source buffer ID of the current file in the main
module. The latter is needed for excluding buffer ID for dependency checking.

rdar://problem/66301353
2020-07-30 09:27:58 -07:00
swift-ci
8724a0117b Merge remote-tracking branch 'origin/master' into master-rebranch 2020-07-29 08:10:41 -07:00