Commit Graph

7628 Commits

Author SHA1 Message Date
Arnold Schwaighofer
ef0bb9932d Re-enable remote_run tests that were disabled
The underlying issue was supposedly fixed a while ago.
2021-08-03 13:51:15 -07:00
Guillaume Lessard
92335b115a Merge pull request #38677 from glessard/sr14491-v1
[stdlib] fast path for UMBP.initialize<C>(from: C) when C is a Slice
2021-08-03 11:28:32 -06:00
Guillaume Lessard
1e6b758330 Merge pull request #38509 from glessard/sr14850
[stdlib] prevent MutableCollections from inappropriately inheriting a Slice<Self> subscript
2021-08-02 14:12:29 -06:00
Alex Hoppen
f42f961faf [Sema] Copy key path component types when merging solutions
In 2eeff365b1 I forgot to copy key path component types when applying a solution to the constraint system. That caused a crash in key path code completion.

Fixes rdar://81118700 [SR-14979]
2021-07-30 11:07:21 +02:00
Nate Chandler
4a8a647e4c [Test] Used test header rather than SDK.
Stopped validation-test/compiler_crashers_2_fixed/rdar79383990.swift
from trying to call -[NSBackgroundActivityScheduler scheduleWithBlock:]
async--that method is now annotated NS_SWIFT_DISABLE_ASYNC.
2021-07-28 20:37:46 -07:00
Guillaume Lessard
23bed3118b [test] test UnsafeMutableBufferPointer.initialize(from: Slice<_>) 2021-07-28 14:32:57 -06:00
Alex Hoppen
1a7d98795c Merge pull request #38474 from ahoppen/pr/dont-precheck-twice
[CodeCompletion] Allow preChecking an expression twice in code completion
2021-07-28 21:51:16 +02:00
Alex Hoppen
77cb4b639c Merge pull request #38559 from ahoppen/pr/dont-add-members-twice
[CodeCompletion] Fix issue causing the completion status to not be set correctly for pattern completion
2021-07-28 18:22:42 +02:00
Alex Hoppen
fec7f6c3c0 [CodeCompletion] Fix issue causing the completion status to not be set correctly for pattern completion
We weren’t setting the code completion token status correctly when parsing patterns with code completion tokens.

Because of this, in the added test case, the `searchSubject` gets added as a member of `Foo` twice - once in the first pass and once in the second pass, causing an assertion failure.

Fixes rdar://80575116 [SR-14687]
2021-07-26 20:50:10 +02:00
nate-chandler
8345174bae Merge pull request #38370 from nate-chandler/rdar79383990
[SILGen] Used formal type when bridging completion handler arguments.
2021-07-26 10:57:49 -07:00
Nate Chandler
c493632b68 [SILGen] Used type AbstractionPattern.
Previously, AbstractionPattern::getOpaque() was used for async
continuations.  That was problematic for functions like

```objc
- (void)performVoid2VoidWithCompletion:(void (^ _Nonnull)(void (^ _Nonnull)(void)))completion;
```

whose completion takes a closure.  Doing so resulted in attempting to
build a block to func thunk where one of the functions had an out
parameter.

Instead, use the AbstractionPattern(ty).

rdar://79383990
2021-07-24 14:25:27 -07:00
Hamish Knight
2d951efd8b [CS] Don't bail out of CollectVarRefs early
Upon encountering an ErrorExpr, we were previously
bailing from the walk. However, for multi-statement
closures, that could result in us missing some
variable references required to connect to the
closure to its enclosing context. Make sure to
continue walking to catch those cases.

SR-14709
rdar://78781677
2021-07-21 23:04:06 +01:00
Guillaume Lessard
0ea4e3c4d9 [stdlib] add availability annotations and tests 2021-07-21 09:20:12 -06:00
Alex Hoppen
202905fe40 [CodeCompletion] Allow preChecking an expression twice in code completion
In code completion we might call `preCheckExpression` twice - once for the first pass and once for the second pass. This is fine since `preCheckExpression` idempotent, so don't assert if we are in code completion mode.

Fixes rdar://79136653 [SR-14755]
2021-07-21 11:16:16 +02:00
Guillaume Lessard
3789ce292a [stdlib] fix an accidental recursion bug involving MutableCollection
- add a default implementation of MutableCollection’s
  subscript(bounds: Range<_>) with the most general signature possible
- it is marked unavailable in order to prevent the
  infinite recursion bug reported in SR-14848
- add a conditionally-available subscript(bounds: Range<_>) -> Slice<Self>
  only when Subsequence is Slice<Self>. This will supersede
  the unconditional extension that provides the same signature.
2021-07-20 16:11:23 -06:00
Pavel Yaskevich
befe4bd2ab Revert "[CSGen] Don't apply one-way requirement to typed patterns" 2021-07-20 14:35:49 -07:00
Guillaume Lessard
473b5737d4 [test] add a definition that shouldn't compile 2021-07-20 13:25:55 -06:00
Slava Pestov
8d65042d22 SIL: Fix verifier failure when witness_method's lookup type involves dynamic Self
Fixes rdar://problem/80296242.
2021-07-19 21:25:05 -04:00
David Ungar
2c05750bc1 Merge pull request #38467 from davidungar/again
Use `getOriginalInit` instead of `PatternBindingEntry::hasInitStringRepresentation`
2021-07-19 11:57:53 -07:00
Hamish Knight
74b6dd8404 [test] Fix validation-test/IDE/slow/rdar45511835.swift 2021-07-19 15:24:06 +01:00
David Ungar
fc0eca5f20 add a regression test 2021-07-18 20:11:51 -07:00
Pavel Yaskevich
b60c82610c Merge pull request #38328 from xedin/rdar-79657350
[Diagnostics] Diagnose ambiguous solutions with warnings like regular…
2021-07-09 22:52:36 -07:00
3405691582
ac9640b00a [stdlib] Changes to support Foundation on OpenBSD.
* Not implementing POSIXError for a given platform is not a blocking
  problem to getting a successful build of Swift. However, it is
  part of the validation tests (albeit locked behind REQUIRES) and is
  referenced when building Foundation. Implement by forklifting from
  `sys/errno.h`.

* Some Foundation class implementations require some missing includes in
  the platform modulemap. Add these.
2021-07-09 18:55:51 -04:00
Pavel Yaskevich
66b1149abd [CSGen] Don't apply one-way requirement to typed patterns
Typed patterns are represented by a name and a fixed contextual
type, let's not use intermediary type variable and one-way constraint
as its type because that variable would be bound right away to
contextual type. Also setting type of a variable declaration
to a type variable when contextual type is IUO doesn't play well
with overload resolution because it expects an optional type for
declarations with IUO attribute.

Resolves: rdar://80271666
2021-07-09 14:50:17 -07:00
Pavel Yaskevich
d1e12785ed [Diagnostics] Diagnose ambiguous solutions with warnings like regular ambiguities
If solutions either have no fixes at all or all of the are warnings,
let's use `diagnoseAmbiguity` to diagnose such cases as-if there are
no fixes at all.

Resolves: rdar://79657350
2021-07-08 22:06:12 -07:00
Mishal Shah
0ebceda18b Mark android_cross_compile.test unsupported for iOS, tvOS, and watchOS 2021-07-06 15:25:39 -07:00
Guillaume Lessard
6053c47f6d Merge pull request #38161 from glessard/sr14848
[stdlib] fix an accidental recursion bug involving Collection
2021-07-01 07:58:53 -06:00
Luciano Almeida
7f085082dd Merge pull request #38153 from JiarenWang/wjr
[SR-14824] Improve diagnostic for multi-statement closures instead of…
2021-07-01 08:56:10 -03:00
Guillaume Lessard
7d6260560e [stdlib] fix an accidental recursion bug involving Collection
- adds a default implementation of Collection’s subscript(bounds: Range<_>)
  with the most general signature possible
- it is marked unavailable in order to prevent the
  infinite recursion bug reported in SR-14848
- Collections whose SubSequence is Slice<Self> still get the proper default, as intended.
2021-06-30 21:58:48 -06:00
Butta
de148ada38 [build] disable failing Android cross-compilation test on macOS 2021-07-01 03:17:05 +05:30
Varun Gandhi
a07b4761b3 Merge pull request #33724 from buttaface/core
[build] Add the flags to enable cross-compiling the corelibs
2021-06-30 09:31:51 -07:00
jiaren wang
c5de1f0800 [SR-14824] Improve diagnostic for multi-statement closures instead of saying "too complex closure return type" 2021-06-30 14:36:38 +08:00
Michael Gottesman
d829de1e25 [build-script] Use a toolchain file and always cross compile cmark.
NOTE: We still build for the host platform always, but even in that case within
cmark itself, we are cross compiling it.
2021-06-28 19:26:10 -07:00
Butta
a4ff4db508 [build] Add the flags to enable cross-compiling the corelibs
Pass the Swift and CMake flags needed to cross-compile Foundation and so on, with
the first example of Android. Add a new flag, --cross-compile-deps-path, which is
used to search for cross-compiled libraries, like libcurl, that the corelibs
depend on. Also add a new flag, --common-swift-flags, to pass additional Swift
flags to the corelibs.
2021-06-29 06:41:41 +05:30
Pavel Yaskevich
d08b2d5930 Merge pull request #37957 from xedin/rdar-79414045
[TypeChecker] NFC: Make test-case for rdar://19737632 more complex
2021-06-28 10:04:29 -07:00
Rintaro Ishizaki
6920a472a3 Merge pull request #38036 from rintaro/ide-completion-rdar78781163
[Parse] Don't skip '}' when recovering from 'default' outside 'switch'
2021-06-25 15:54:08 -07:00
Holly Borla
30ec896bcd [NFC] Add a fast type checker test for rdar://74853403. 2021-06-25 11:23:44 -07:00
Pavel Yaskevich
9733fb7562 Merge pull request #38045 from xedin/rdar-79268378
[Diagnostics] Adjust `Self` conformance check to find non-decl overload choices
2021-06-23 12:19:28 -07:00
Mishal Shah
f51923dd8f Merge pull request #37978 from lorentey/postprocess-stress-tests
[test] Add missing postprocessing phase to executable stress tests
2021-06-23 10:51:44 -07:00
Alex Hoppen
e5dc347df7 Merge pull request #37964 from ahoppen/pr/solutions-scoring
[Sema] Use different solution vectors for `ComponentStep`s created by `DependentComponentSplitterStep`
2021-06-23 18:56:06 +02:00
Rintaro Ishizaki
aa182ac8e0 [Parse] Don't skip '}' when recovering from 'default' outside 'switch'
That caused assertion failures in code completion.

rdar://78781163
2021-06-23 08:44:32 -07:00
Varun Gandhi
c53d0eb273 Temporarily mark ArraysObjc test unsupported for watchsimulator-i386.
Earlier, I accidentally marked Arrays.swift.gyb, however the test that
is failing is ArraysObjc.swift.gyb.
2021-06-22 16:16:05 -07:00
Varun Gandhi
9e707e1f40 Revert "Temporarily mark test unsupported for watchsimulator-i386."
This reverts commit dab1254dea.
2021-06-22 16:15:01 -07:00
Pavel Yaskevich
be6e2fad8c [Diagnostics] Adjust Self conformance check to find non-decl overload choices
Use `findSelectedOverloadFor` instead of `findResolvedMemberRef`
to cover cases where member is found via base type unwrap, otherwise
conformance constraint would be re-inserted but never re-attempted
which results in a compiler crash.

Resolves: rdar://79268378
2021-06-22 15:32:51 -07:00
Varun Gandhi
3368d9c597 Merge pull request #38032 from varungandhi-apple/vg-dont-watch-arrays
Temporarily mark test unsupported for watchsimulator-i386.
2021-06-22 12:23:18 -07:00
Varun Gandhi
dab1254dea Temporarily mark test unsupported for watchsimulator-i386. 2021-06-22 12:20:07 -07:00
Pavel Yaskevich
f228f735a3 Merge pull request #38011 from xedin/rdar-79523605
[CSSimplify] Fix warning check to account that "from" might be less optional than "to" type
2021-06-22 11:49:06 -07:00
eeckstein
53fc177261 Merge pull request #37945 from eeckstein/fix-cow-check-availability
stdlib: fix availability for internal COW checks.
2021-06-22 07:20:40 +02:00
Pavel Yaskevich
c1bac12bb6 [CSSimplify] Fix warning check to account that "from" might be less optional than "to" type
While checking whether compiler needs to produce a checked cast warning,
account for the fact that "from" could be less optional than "to" e.g.
`0 as Any?`, so the difference has to be stored as a signed integer
otherwise it's going to underflow and result in a crash or infinite
recursion in the diagnostics.

Resolves: rdar://79523605
2021-06-21 16:38:04 -07:00
Michael Gottesman
acfe645755 [cmake] Disable libswift and cmake tests when building using the Xcode generator.
We should re-enable this once it is clear that there aren't issues with the
Xcode generator/host side swift cmake. The Ninja generator (the default) still
is enabled.
2021-06-20 13:30:29 -07:00