Commit Graph

5674 Commits

Author SHA1 Message Date
Slava Pestov
d37cf8e47a Disable test_backward_deploy_conformance completely on Swift-in-the-OS bots
Fixes <rdar://problem/59670363>.
2020-02-21 13:09:05 -05:00
Dan Zheng
9600b9737a [SIL] Fix use-after-free in SILFunction::print. (#29949)
Fix use-after-free in helper function `printSILFunctionNameAndType`.
The address of a `DenseMap` local variable is used after the function returns.

Resolves SR-12239.
2020-02-20 17:53:38 -08:00
Argyrios Kyrtzidis
d082e90dbc Merge pull request #29975 from akyrtzi/fix-invalid-keypath-expr-crash
[Parse] Try to preserve the invariant that anything that contains KeyPathDotExpr must be wrapped in KeyPathExpr
2020-02-20 17:23:44 -08:00
Pavel Yaskevich
46d945fdcf [ConstraintSystem] Avoid exploring too much search space when call arguments are holes
Detect that disjunction is going to be applied to arguments which
don't provide any additional contextual information and allow only
a single choice to be attempted in such case to avoid triggering
exponential behavior in the solver.

The problem is most visible with operators e.g.

```swift
.foo == .bar || 1 == .baz
```

If neither member could be contextually determined and solver was
allowed to attempt all of the overloads for `==` and `||` that
would lead to exponential behavior (because each has 30+ overloads)
and generation of hundreds of partial solutions.

Resolves: rdar://problem/56400265
2020-02-20 16:52:30 -08:00
Argyrios Kyrtzidis
bbdada475b [Parse] Try to preserve the invariant that anything that contains KeyPathDotExpr must be wrapped in KeyPathExpr
Even in the presence of invalid code. Fixes typechecker crash in rdar://50666427
2020-02-20 15:07:00 -08:00
swift-ci
646a3e2516 Merge pull request #29968 from tbkka/tbkka-validation-test-Sema-sr8209 2020-02-20 14:20:06 -08:00
Tim Kientzle
8ad39887b5 Ignore output data that's not relevant for this test.
The previous code expects output like this:
```
define hidden swiftcc i8* @"$s6SR82094test10ObjectiveC8SelectorVyF"() #0 {
```

But in certain build modes, we get extra debug information that looks like this:
```
define hidden swiftcc i8* @"$s6SR82094test10ObjectiveC8SelectorVyF"() #0 !dbg !47 {
```

I stumbled over this while running tests with a variety of different
options.
2020-02-20 12:28:02 -08:00
Slava Pestov
00ed9e4885 Disable test_backward_deploy_conformance.swift on Swift-in-the-OS bots
We need a backward compatibility shim before this can work.

Fixes <rdar://problem/59631880>.
2020-02-20 13:02:12 -05:00
Rintaro Ishizaki
0ca869e40e Merge pull request #29118 from rintaro/ide-completion-rdar56834798
[CodeCompletion] Allow type variable in MakeAbstractConformanceForGenericType
2020-02-19 09:30:08 -08:00
Pavel Yaskevich
51257ddf73 Merge pull request #29906 from xedin/eliminate-csdiag
[TypeChecker] Obsolete and remove old diagnostics (CSDiag)
2020-02-18 19:46:54 -08:00
Slava Pestov
c4203ddafa Merge pull request #29887 from slavapestov/conformance-cache-sillyness
Runtime: Less eager instantiation of type metadata in the conformance cache
2020-02-17 20:47:47 -05:00
Pavel Yaskevich
df21cbf85c [ConstraintSystem] Ignore attempt to bind type var to dependent member with incorrect base
Just like in cases where both sides are dependent member types
with resolved base that can't be simplified to a concrete type
let's ignore this mismatch and mark affected type variable as a hole
because something else has to be fixed already for this to happen.
2020-02-17 16:09:11 -08:00
Slava Pestov
1ca2b61f7a Runtime: Less eager instantiation of type metadata in the conformance cache
The ConformanceCandidate constructor would eagerly instantiate metadata for
all non-generic types in the conformance cache. This was not the intention
of the code though, because it can compare nominal type descriptors --
which are emitted statically -- for those types that have them, namely
everything except for foreign and Objective-C classes.

Change the order of two calls so that the lazy path has a chance to run.
This fixes a crash when type metadata uses weakly-linked symbols
which are not available, which can come up in backward deployment
scenarios.

Fixes <rdar://problem/59460603>.
2020-02-17 16:24:42 -05:00
Pavel Yaskevich
ae79b0d0bd [CSApply] Always use String type for ObjC interop key path
If it's possible to build an Objective-C key path for key path
expression make sure that its implicitly generated string literal
expression has a `String` type.

Resolves: rdar://problem/57356196
2020-02-15 00:04:09 -08:00
Slava Pestov
06855f758d AST: Remove a couple of redundant statistics 2020-02-12 18:29:27 -05:00
swift-ci
7e61734c2d Merge remote-tracking branch 'origin/master' into master-rebranch 2020-02-07 20:23:29 -08:00
Slava Pestov
134cab6156 Add regression test for https://bugs.swift.org/browse/SR-9225 2020-02-07 20:33:54 -05:00
swift-ci
ac3ce0d3c4 Merge remote-tracking branch 'origin/master' into master-rebranch 2020-02-06 13:43:41 -08:00
swift-ci
cf3c4aa3f5 Merge remote-tracking branch 'origin/master' into master-rebranch 2020-02-05 16:06:28 -08:00
Hamish Knight
5ed2847f4e Create a new module and SourceFile for REPL completion
Rather than attempting to temporarily insert decls
into the last source file, just create a new module
and source file and carry across the imports from
the last module. This matches how the REPL deals
with new lines of input.
2020-02-05 14:01:20 -08:00
Hamish Knight
312f7ddc50 Parse Swift decls in one shot
Instead of interleaving typechecking and parsing
for SIL files, first parse the file for Swift
decls by skipping over any intermixed SIL decls.
Then we can perform type checking, and finally SIL
parsing where we now skip over Swift decls.

This is an intermediate step to requestifying the
parsing of a source file for its Swift decls.
2020-02-04 13:04:50 -08:00
swift-ci
f0e501c70c Merge remote-tracking branch 'origin/master' into master-rebranch 2020-02-03 16:22:49 -08:00
Ross Bayer
7ff9ba1220 Merge pull request #29613 from Rostepher/no-more-flaky-flake8
[Python: flake8] Update the utils/python_lint.py script to fail with a non-zero exit code if flake8 and flake8-import-order are not installed.
2020-02-03 16:20:36 -08:00
swift-ci
de523861ee Merge remote-tracking branch 'origin/master' into master-rebranch 2020-02-03 14:43:43 -08:00
Ross Bayer
c096e29967 [Python: flake8] Update the utils/python_lint.py script to fail with a non-zero exit code if flake8 and flake8-import-order are not installed. 2020-02-03 13:10:15 -08:00
Pavel Yaskevich
6d671020b9 [TypeChecker/BuilderTransform] Make sure implicit load expression updates types in AST
Can't use `ConstraintSystem::addImplicitLoadExpr` because that would
only cache types in constraint system and wouldn't propagate them to AST,
since that happens in `ExprRewritter::finalize` during regular solution
application. `TypeChecker::addImplicitLoadExpr` should be used directly
in cases like that.

Resolves: rdar://problem/58972627
2020-02-03 11:45:55 -08:00
swift-ci
8d2c7ac43e Merge remote-tracking branch 'origin/master' into master-rebranch 2020-01-29 11:23:12 -08:00
David Ungar
5b8ba88296 Merge pull request #29525 from davidungar/type-prints-off-by-default2
[Incremental] Tests and bug fixes for per-type fingerprints.
2020-01-29 11:18:56 -08:00
swift-ci
054c288643 Merge remote-tracking branch 'origin/master' into master-rebranch 2020-01-29 08:24:01 -08:00
Chris Amanse
ffa6bf4729 Fix memory leaks in ThreadBarriers.swift (#12212)
* Fix memory leaks in ThreadBarriers.swift

* Fatal error on pthread cond/mutex destroy failure

* Rename pthread to thread

* Fix pthread init function calls

* Fix guard statement
2020-01-29 08:21:52 -08:00
David Ungar
bbffc0959b Tests for type fingerprints are enabled. 2020-01-28 20:06:44 -08:00
swift-ci
dd4488eb2d Merge remote-tracking branch 'origin/master' into master-rebranch 2020-01-28 13:04:30 -08:00
Robert Widmann
c81cecf653 Merge pull request #29491 from CodaFi/constraint-kinds
[GSB] Map invalid subject types in requirement constraints to ErrorType
2020-01-28 12:52:57 -08:00
Mike Ash
5f4fcced99 Merge pull request #29495 from mikeash/existentials-no-os-stdlib
[Test] Mark Reflection/existentials.swift as unsupported when testing against the OS stdlib.
2020-01-28 14:34:56 -05:00
Robert Widmann
88d6559722 [GSB] Map invalid subject types in requirement constraints to ErrorType
Resolves SR-12072 and rdar://58941114
2020-01-28 10:15:43 -08:00
swift-ci
81a6a266aa Merge remote-tracking branch 'origin/master' into master-rebranch 2020-01-27 18:23:23 -08:00
Mike Ash
76a6f88b3a [Test] Mark Reflection/existentials.swift as unsupported when testing against the OS stdlib, as the test looks for a recent Remote Mirror addition to print the mangled name of a typeref.
rdar://problem/58939662
2020-01-27 21:04:32 -05:00
David Ungar
84fa03f757 Added -disable-type-fingerprints to tests. 2020-01-27 15:14:46 -08:00
swift-ci
1db2b06e58 Merge remote-tracking branch 'origin/master' into master-rebranch 2020-01-25 23:24:24 -08:00
Rintaro Ishizaki
407b6c4b1d Merge pull request #29416 from marcrasi/add-complete-repl-test
negative test for SR-12076: completion crash
2020-01-25 23:08:43 -08:00
swift-ci
72229ba355 Merge remote-tracking branch 'origin/master' into master-rebranch 2020-01-24 16:43:36 -08:00
Slava Pestov
305620b354 ClangImporter: Reconcile Clang declaration hidden-ness between loadAllMembers() and lazy loading
Lazy loading checked if the ClangDecl was hidden, but loading all
members did not. Let's make loadAllMembers() behave like the lazy
path, and fix some of the mock SDKs in the test suite.
2020-01-24 17:07:08 -05:00
Marc Rasi
d608220360 negative test for SR-12076: completion crash 2020-01-24 10:12:39 -08:00
swift-ci
5ef7482da1 Merge remote-tracking branch 'origin/master' into master-rebranch 2020-01-24 09:43:51 -08:00
Pavel Yaskevich
d412ea4d16 [Diagnostics] Unsatisfied requirement in reference diagnostics expect type context
Resolves: rdar://problem/50666427
2020-01-23 10:14:37 -08:00
swift-ci
a48309f8b1 Merge remote-tracking branch 'origin/master' into master-rebranch 2020-01-21 12:03:41 -08:00
Doug Gregor
8283a67648 Revert "Revert "Reimplement function builders as statement transformations."" 2020-01-21 10:07:20 -08:00
swift-ci
677787741d Merge remote-tracking branch 'origin/master' into master-rebranch 2020-01-21 09:23:10 -08:00
Doug Gregor
423adbc089 Merge pull request #29292 from apple/revert-29133-generlize-function-builders
Revert "Reimplement function builders as statement transformations."
2020-01-21 09:10:20 -08:00
swift-ci
b696f6b808 Merge remote-tracking branch 'origin/master' into master-rebranch 2020-01-19 17:23:50 -08:00