Commit Graph

120591 Commits

Author SHA1 Message Date
Slava Pestov
c52affbd68 Merge pull request #37440 from slavapestov/clean-up-generic-requirement-checking
Clean up duplicate logic for checking if generic requirements are satisfied
2021-05-17 19:28:18 -04:00
Ben Barham
ccd39760cf Merge pull request #37441 from bnbarham/serialization-crashes
[Serialization] Do not assert when inherited type is null
2021-05-18 09:14:06 +10:00
Xi Ge
0d4d98eeb0 Merge pull request #37458 from nkcsgexi/string-as-version
CanImport: allow using string literal to indicate desired version
2021-05-17 14:26:55 -07:00
Ben Langmuir
006e78e672 Merge pull request #37320 from fwcd/sourcekit-diagnostic-ids
[SourceKit] Add id and category to diagnostics
2021-05-17 14:25:40 -07:00
Ben Langmuir
c8169c3ee6 Merge pull request #37457 from benlangmuir/disable-CursorInfoTest.CursorInfoMustWaitDueTokenRace
[test] Disable CursorInfoTest.CursorInfoMustWaitDueTokenRace
2021-05-17 14:25:05 -07:00
Slava Pestov
131d3f4bce Sema: Pass down a ModuleDecl instead of a DeclContext to conformsToProtocol()
... and a bunch of follow-up simplifications pushing ModuleDecls further
up, since I couldn't resist the yak shave.
2021-05-17 16:34:18 -04:00
Slava Pestov
b556cb5d70 IDE: Refactor SynthesizedExtensionAnalyzer to use Requirement::isSatisfied() 2021-05-17 16:34:18 -04:00
Slava Pestov
73deb7e833 Sema: Introduce a simpler form of checkGenericArguments() 2021-05-17 16:34:18 -04:00
Slava Pestov
ee33f12df7 IDE: Refactor IsDeclApplicableRequest to use Requirement::isSatisfied() 2021-05-17 16:34:17 -04:00
Slava Pestov
6cb64c4a8d AST: Refactor GenericSignature::isRequirementSatisfied() to use Requirement::isSatisfied()
This becomes a utility that maps the requirement's types into the
generic environment if needed before calling out to the new
Requirement::isSatisfied().
2021-05-17 16:34:17 -04:00
Slava Pestov
fe06df8288 AST: Move guts of checkGenericArguments() to a new Requirement::isSatisfied() method 2021-05-17 16:34:17 -04:00
Slava Pestov
40aa87c9f4 Sema: Clean up checkGenericArguments() a bit 2021-05-17 16:31:46 -04:00
Xi Ge
e0b8de4d49 Merge pull request #37455 from nkcsgexi/user-module-subminor
Serialization: embed subminor and build version in the user module version entry
2021-05-17 13:15:25 -07:00
Pavel Yaskevich
1f005e16e9 Merge pull request #37451 from xedin/adjust-changelog-entry-format
[ChangeLog] NFC: Adjust format of the last entry to render correctly
2021-05-17 12:30:33 -07:00
Ben Rimmington
0e2e11d1d2 [docs] Update Testing.md (#37399) 2021-05-17 19:42:52 +01:00
Xi Ge
ebfa459b3e CanImport: allow using string literal to indicate desired version 2021-05-17 11:10:41 -07:00
Ben Rimmington
ff12adf62b [test] Update get_simulator_command for macOS 11 (#37446) 2021-05-17 18:37:00 +01:00
Ben Langmuir
f6b251816c [test] Disable CursorInfoTest.CursorInfoMustWaitDueTokenRace
Until we figure out why this is (rarely) failing in CI, disable the
test.

rdar://55314062
2021-05-17 10:29:19 -07:00
Xi Ge
5c5715f626 Serialization: embed subminor and build version in the user module version entry 2021-05-17 10:15:47 -07:00
Alex Hoppen
3b2372307c Merge pull request #37421 from ahoppen/pr/fix-crash-complete-in-result-builder-with-nil
[CodeComplete] Fix crash when completing inside a result builder containing a variable initialized with `nil`
2021-05-17 18:56:45 +02:00
Pavel Yaskevich
5f060d228f [ChangeLog] NFC: Adjust format of the last entry to render correctly 2021-05-17 09:43:39 -07:00
Artem Chikin
f832153e28 Merge pull request #37433 from artemcm/PassCrossCompilHostsToSwiftDriverBuild
[Build Script] Pass down cross compilation host targets to swift-driver build
2021-05-17 09:03:04 -07:00
Arnold Schwaighofer
58b7bbdc81 Merge pull request #37444 from aschwaighofer/tail_call_opt_force_swift_task_switch_impl
Make sure we tail call optimize a call in concurrency runtime's switch_task_impl.
swift-DEVELOPMENT-SNAPSHOT-2021-05-17-a
2021-05-17 06:32:29 -07:00
Arnold Schwaighofer
b0c977f149 This test fails on windows 2021-05-16 07:24:15 -07:00
Arnold Schwaighofer
9b4f7d62cd Make sure we tail call optimize a call in concurrency runtime's switch_task_impl.
Without this hack the call will leave a stack frame around (not tail
call optimized) and blow the stack if we call switch_task often enough.

Ideally, clang would emit this call as `musttail` but currently it does
not.

rdar://76652421
2021-05-15 08:07:55 -07:00
Ben Barham
c1e4362dfd [Serialization] Do not assert when inherited type is null
When compiling with allow errors, it's possible to have invalid
inherited types - both null and ErrorType.

Cleaned up the tests a little - moved the majority of
Frontend/allow-errors.swift into separate files in
Serialization/AllowErrors and use split_file.py instead of #defines.

Resolves rdar://78048470
2021-05-15 16:35:23 +10:00
Pavel Yaskevich
f69dfc2e9a Merge pull request #36705 from HassanElDesouky/delay-loading-localization
[Localization] Delay loading localization on startup
swift-DEVELOPMENT-SNAPSHOT-2021-05-16-a
2021-05-14 20:26:29 -07:00
Slava Pestov
760d7997de Merge pull request #37434 from slavapestov/fix-generic-override-crash
Sema: Fix a couple of issues with implicit overrides of generic designated initializers
2021-05-14 23:19:04 -04:00
Andrew Trick
4d7321edba Merge pull request #37429 from nkcsgexi/78027229
test: specify touch time to ensure mod time difference
2021-05-14 17:40:59 -07:00
Artem Chikin
5ba154e2d1 [Build Script] Pass down cross compilation host targets to swift-driver build 2021-05-14 16:41:03 -07:00
Slava Pestov
379220b9e2 Sema: Fix a couple of issues with implicit overrides of generic designated initializers
If a base class initializer was not generic but had a contextual 'where'
clause, we would unconditionally inherit the 'where' clause in the override as
part of the fix for another issue (https://bugs.swift.org/browse/SR-14118).

However, it is possible that some of those requirements are satisfied by
the derived class itself. For example:

    class Base<T> {
        init() where T : AnyObject {}
    }

    class Derived : Base<AnyObject> {}

In this case, the implicit override Derived.init() has no generic requirements
at all. We used to assert because we would create a GSB with no generic
parameters.

It was also possible for a base class initializer to have generic
requirements that are not satisfied by the derived class. In this case,
we need to drop the initializer from consideration altogether.

While I'm here, I improved the comments in computeDesignatedInitOverrideSignature(),
which is the new name for configureGenericDesignatedInitOverride().

Fixes rdar://problem/77285618.
2021-05-14 19:02:57 -04:00
Xi Ge
736b8ac61f Merge pull request #37423 from nkcsgexi/78021402
driver: emit a warning when user specified flags to disable the new driver
2021-05-14 14:15:09 -07:00
Xi Ge
ae4781dd90 test: specify touch time to ensure mod time difference
rdar://78027229
2021-05-14 13:04:44 -07:00
Xi Ge
e24eef4b35 driver: emit a warning when user specified flags to disable the new driver
rdar://78021402
2021-05-14 11:00:36 -07:00
Alex Hoppen
bf4a4af82a Merge pull request #37382 from kimdv/kimdv/fix-wrong-child-syntax-kind
[SwiftSyntax]: Use check for suffix instead of contains when checking for token
2021-05-14 19:23:16 +02:00
Alex Hoppen
ad5dc2d76f [CodeComplete] Fix crash when completing inside a result builder containing a variable initialized with nil
Resolves rdar://78017503
2021-05-14 17:21:26 +02:00
Alex Hoppen
b0bade6711 Merge pull request #37417 from bnbarham/add-completionhandler-attribute
[Refactoring] Add @completionHandlerAsync to sync function
2021-05-14 17:09:58 +02:00
Chris Adamson
af4ebb4c46 Provide doc comments for AsyncSequence and related types (#37383)
* First draft docs for iterator, sequence type.

Also drop(while:), to get a feel for the AsyncSequence->AsyncSequence cases.

* Source docs for contains and reduce.

* Docs for methods in AsyncSequence.

This covers all the methods that return a single value. Still working on the extension methods that return new sequences.

* Early source docs for dropFirst(_:) and its type

* Correct doc format for dropFirst(_:).

* Prefix, plus some fixes.

* Docs for prefix(while:).

* Apply Philippe's snippet fixes.

* First draft docs on the map sequences.

Plus miscellaneous fixes throughout.

* Show result of flatMap example.

* More explicit cancellation guidance.

* Convert snippets to trailing closures.

* Correct misplaced doc comments.

* Apply suggestions from code review

Co-authored-by: Philippe Hausler <phausler@apple.com>

* Apply editorial feedback.

* Apply additional editorial feedback.

* Apply suggestions from code review

Co-authored-by: bjlanier <blanier@apple.com>

* Apply further editorial feedback.

Co-authored-by: Chris Adamson <cadamson@apple.com>
Co-authored-by: Philippe Hausler <phausler@apple.com>
Co-authored-by: bjlanier <blanier@apple.com>
2021-05-14 10:16:36 -04:00
Hamish Knight
5b2f40a006 Merge pull request #37411 from hamishknight/returning-so-soon 2021-05-14 13:37:17 +01:00
Ben Barham
762337cc9b [Refactoring] Add @completionHandlerAsync to sync function
When adding an async alternative, add the @completionHandlerAsync
attribute to the sync function. Check for this attribute in addition to
the name check, ie. convert a call if the callee has either
@completionHandlerAsync or a name that is completion-handler-like name.

The addition of the attribute is currently gated behind the experimental
concurrency flag.

Resolves rdar://77486504
2021-05-14 20:19:02 +10:00
Hamish Knight
87703a0716 [test] Add test for async completion handler call in parens
We don't currently handle this, but arguably we
should be able to.
2021-05-14 11:17:59 +01:00
Hamish Knight
7ab5915750 [Refactoring] Don't drop returns with expressions
Previously we were unconditionally dropping a
return statement if it was the last node, which
could cause us to inadvertently drop the result
expression as well. Instead, only drop bare
'return' statements.

rdar://77789360
2021-05-14 11:17:59 +01:00
Hamish Knight
aa189f2fe9 [Refactoring] Avoid duplicating return statements
It's possible the user has already written an
explicit return for the call to the completion
handler. In that case, avoid adding another return.

rdar://77789360
2021-05-14 11:17:59 +01:00
Hamish Knight
854a8bcb42 [IDE] Allow SourceEntityWalker to keep track of its ASTWalker
This will allow it to be queried for things like
the parent ASTNode in the current traversal.
2021-05-14 11:17:59 +01:00
Hamish Knight
d7d58cbbb2 [Refactoring] Tweak handling of return and break placeholders
- Add a missing return to the break statement
placeholder handling.

- Only turn the `return` token into a placeholder,
as we still want to apply the transformation to
the sub expression.

This stops us from crashing by attempting to walk
into the return sub-expression.

rdar://77789360
2021-05-14 11:17:57 +01:00
swift-ci
2074057785 Merge pull request #37415 from DougGregor/remove-asynchandler swift-DEVELOPMENT-SNAPSHOT-2021-05-14-a 2021-05-13 19:47:46 -07:00
swift-ci
e0eff4885e Merge pull request #37287 from plotfi/cxx-interop-anon-union 2021-05-13 19:47:37 -07:00
Doug Gregor
2b9ca315fe [Concurrency] Remove asyncHandler attribute.
The `asyncHandler` attribute turned out to be the wrong solution
to the problem of creating a sync->async bridge. Remove it.
2021-05-13 17:01:39 -07:00
Hassan
481b29b6ca [Localization] Delay loading localization
- Add `LocalizationProducerState` to manage the states of LocalizationProducers.
- Add `initializeImpl` and `initializeIfNeeded` to manage lazily initialization of `LocalizationProducer`s.
- Move constructing a localization producer from DiagEngine to `LocalizationProrducer` itself.
2021-05-14 01:28:55 +02:00
Joe Groff
8e1dcb481f Merge pull request #37393 from jckarter/disable-flaky-objc-async-test
Disable flaky test/Concurrency/Runtime/objc_async.swift test.
2021-05-13 16:13:02 -07:00