Commit Graph

5277 Commits

Author SHA1 Message Date
Slava Pestov
b2f0327516 IDE: Remove getTypeFromMangledSymbolname()
There was only one remaining usage other than in testing tools.

Note that when a declaration mangling was passed in, the old entry
point would (try to) return the type of the declaration.

The new entry point no longer has this behavior. I changed the
bridging-header-first test to run lldb-moduleimport-test with
-decl-from-mangled instead of -type-from-mangled-old to preserve
the behavior of the test.

Also, I removed test/DebugInfo/DumpTypeFromMangledName.swift
completely. This test only covered a handful of cases, and a bunch
of them were declaration manglings rather than type manglings.
The new tests in test/TypeDecoder/ are much more comprehensive.
2019-02-08 02:56:05 -05:00
Saleem Abdulrasool
920b2f7127 Merge pull request #22415 from drodriguez/standarize-darwin-glibc-msvcrt
[tests] Standarize the checks for Darwin, Glibc and MSVCRT.
2019-02-07 12:52:45 -08:00
Karoy Lorentey
e66969a49c Merge pull request #22320 from lorentey/disable-long-running-tests
[test] Require optimized stdlib for Collection validation tests
2019-02-06 18:11:45 -08:00
Michael Ilseman
a742a62c18 [String] Use the new value in utf8 setter.
ð
2019-02-06 15:11:17 -08:00
Daniel Rodríguez Troitiño
d08b46c47e [tests] Standarize the checks for Darwin, Glibc and MSVCRT.
Different tests used different os checks for importing Darwin, Glibc and
MSVCRT. This commit use the same pattern for importing those libraries,
in order to avoid the #else branches of the incorrect patterns to be
applied to the wrong platform. This was very normal for Android, which
normally should follow the Linux branches, but sometimes was trying to
import Darwin or not importing anything.

The standarized pattern imports Darwin for macOS, iOS, tvOS and watchOS.
It imports Glibc for Linux, FreeBSD, PS4, Android, Cygwin and Haiku; and
imports MSVCRT for Windows. If a new platform is introduced, the else
branch will report an error, so the new platform can be added to one of
the branches (or maybe add a new specific branch).

In some cases  the standard pattern was modified because some test required
it (importing extra modules, or extra type aliases), and in some other
cases some branches were removed because the test will not have used
them (but it is not exhaustive, so there might be some unnecessary
branches).

This should, at least, fix three tests for Android (the three
dynamic_replacement*.swift ones).
2019-02-06 10:51:55 -08:00
Jordan Rose
1a4c5f5e0c [test] verify_all_overlays doesn't actually fail on watchOS
Further fix-up for 482d2baccd.
2019-02-05 14:12:15 -08:00
Joe Shajrawi
fe59328a4c Merge pull request #22362 from shajrawi/sr9849
[LoadableByAddress] handle functions that return a closure in a tuple
2019-02-05 10:36:49 -08:00
Jordan Rose
e9da05902c [test] Echo all failures to the same file
Fix-up for 482d2baccd. This slipped in while I was moving things
around, but fortunately that part of the test isn't currently failing.
2019-02-04 19:37:43 -08:00
Joe Shajrawi
9e560ce785 [LoadableByAddress] handle functions that return a closure in a tuple 2019-02-04 17:25:49 -08:00
Jordan Rose
482d2baccd Make verify_all_overlays.sil fail loudly instead of silently (#22325)
...then XFAIL it. Filed https://bugs.swift.org/browse/SR-9847 to look
into it later.
2019-02-04 11:53:25 -08:00
Karoy Lorentey
2c8a55f8eb [test] Regenerate Collection validation tests 2019-02-01 18:33:30 -08:00
Karoy Lorentey
33a8962d5e [test] Fix bitrot in Collection validation test gyb 2019-02-01 18:33:29 -08:00
Karoy Lorentey
52f2b0a901 [test] Require optimized stdlib for Collection validation tests
These take too long to run with unoptimized stdlib builds, causing timeout issues.

rdar://problem/46878013
2019-02-01 18:33:29 -08:00
Mishal Shah
cc78af105f Merge pull request #22274 from apple/update-master-xcode-10.2-beta-1
Update master to build with Xcode 10.2 beta 1
2019-02-01 16:30:58 -08:00
Ben Cohen
95a15d12bd Revert count(where:) (#22289) 2019-02-01 15:05:06 -08:00
Max Moiseev
556e089d19 Merge pull request #22138 from moiseev/spring-cleaning
[stdlib] Remove a bunch of declarations marked as obsoleted in 4
2019-02-01 11:03:37 -08:00
Ben Cohen
779ea19a6a Revert count(where:) 2019-01-31 18:57:17 -08:00
Ben Cohen
2010f02e8a Remove overly-permissive UnsafePointer init 2019-01-31 18:05:11 -08:00
Mishal Shah
42633218c5 Update master to build with Xcode 10.2 beta 1 2019-01-31 14:48:29 -08:00
Pavel Yaskevich
0b29d9d4e6 [ConstraintSystem] Decouple designated types feature from Swift version
`selectApplyDisjunction` only makes sense in conjunction with
designated types feature because it's going to prioritize disjunctions
with arguments which are known to conform to literal protocols.

Prioritization like that is harmful without designated types feature
because it doesn't always lead to better constraint system splits,
and could prioritize bigger disjunctions which harms chances to
short-circuit solving.

Resolves: rdar://problem/47492691
2019-01-31 11:48:35 -08:00
Maxim Moiseev
9a81ac7bbd Remove obsolete tests from FixedPointDiagnostics (again) 2019-01-29 16:26:46 -08:00
David Smith
e7a007f231 InvalidStrideable.swift accidentally didn't catch the thing it was meant to test, and now just always crashes. This represents a small regression (possibly?) in diagnostic quality for an obscure edge case, but bringing that back can wait, we shouldn't leave the test crashing until then 2019-01-28 16:01:15 -08:00
Slava Pestov
a14f345c82 lldb-moduleimport-test: Add support for testing Demangle::getTypeForMangling()
The -type-from-mangled flag now uses the new API. The -type-from-mangled-old flag
uses the old API, ide::getTypeFromMangledSymbolname().

For now, just change all existing tests to use the -type-from-mangled-old flag;
I'll be adding new tests for the new API shortly.
2019-01-25 21:44:02 -05:00
Jordan Rose
37c30b1710 Merge pull request #21999 from jrose-apple/from-exponential-expletives-to-quadratic-quality
Cut down on exponential growth in checking switch exhaustivity.
2019-01-22 11:49:51 -08:00
Pavel Yaskevich
33cff97ab2 [Sema] Fix resolveDependentMemberType to properly handle nested types found in enum/struct/class
Currently if member has been found through same-type constraint
it would only be properly handled when it comes from a class type,
because that's the only time when base type gets replaced with
"concrete" type from equivalence class, but nested types could also
come from structs, enums and sometimes protocols (e.g. typealias)
which `resolveDependentMemberType` has to handle.

Resolves: rdar://problem/47334176
2019-01-20 01:59:40 -08:00
Jordan Rose
671944df0c Cut down on exponential growth in checking switch exhaustivity.
The problem Assume 'A' and 'B' are enums with cases .a1, .a2, etc. and
.b1, .b2, etc. If we try to typecheck this switch:

    switch (a, b) {
    case (.a1, .b1),
         (.a1, .b2):
      break
    ...

The compiler is going to try to perform the following series of
operations:

    > var s = (A, B)
    > s -= (.a1, .b1)
    ((A - .a1, B) | (A, B - .b1))
    > s -= (.a1, .b2)
    (((A - .a1, B) | (A - .a1, B - .b2)) |
     ((A - .a1, B - .b1) | (A, B - .b1 - .b2)))
    ...

As you can see, the disjunction representing the uncovered space is
growing exponentially. Eventually some of these will start
disappearing (for instance, if B only has .b1 and .b2, that last term
can go away), and if the switch is exhaustive they can /all/ start
disappearing. But several of them are also redundant: the second and
third cases are fully covered by the first.

I exaggerated a little: the compiler is already smart enough to know
that the second case is redundant with the first, because it already
knows that (.a1, .b2) isn't a subset of (A - .a1, B). However, the
third and fourth cases are generated separately from the first two,
and so nothing ever checks that the third case is also redundant.

This patch changes the logic for subtracting from a disjunction so
that

1. any resulting disjunctions are flattened, and
2. any later terms that are subspaces of earlier terms are dropped

This is a quadratic algorithm in the worst case (compare every space
against every earlier space), but because it saves us from exponential
growth (or at least brings down the exponent) it's worth it. For the
test case now committed in the repository, we went from 40 seconds
(using -switch-checking-invocation-threshold=20000000 to avoid cutting
off early) to 0.2 seconds.

I'll admit I was only timing this one input, and it's possible that
other complex switches will not see the same benefit, or may even see
a slowdown. But I do think this kind of switch is common in both
hand-written and auto-generated code, and therefore this is likely to
be a benefit in many places.

rdar://problem/47365349
2019-01-18 18:36:58 -08:00
Jordan Rose
73fba19a97 [test] Tweak class-layout-from-objc.m to avoid macros named "check"
rdar://problem/47389594
2019-01-18 16:41:38 -08:00
Slava Pestov
93c386d263 Parse: Skip function bodies when delayed member parsing mode is on
Fixes <rdar://problem/47305142>.
2019-01-18 00:15:53 -05:00
Devin Coughlin
d1026ed5bc Merge pull request #21965 from devincoughlin/asan-backdeployment-tests-unsupported
[Tests] Disable backward deployment tests requiring ASan
2019-01-17 17:45:15 -08:00
Jordan Rose
7629253ab5 Test that newer libobjcs let the Swift runtime set up a class's layout (#21942)
Specifically, when the class is referenced from Objective-C first,
before being referenced from Swift in any way. This is important for
resilience, since up until now Objective-C isn't used to the size of a
class changing based on anything other than a superclass's size
changing.

This is basically the test that would have gone with 9024768b0 had
there been a build of libobjc to test it with.

rdar://problem/45718008
2019-01-17 17:39:44 -08:00
Devin Coughlin
b9256d8337 [Tests] Disable backward deployment tests requiring ASan
Test requiring ASan are currently failing on internal bots that test
back deployment because of a test infrastructure problem with ASan bac
 deployment.

Mark those tests as unsupported for remote_run (which is currently only used
for those back-deployment tests) until we can address the underlying issue.
2019-01-17 16:10:58 -08:00
sarveshtamba
c1612c73c3 Merge branch 'master' of https://github.com/apple/swift 2019-01-17 06:57:21 +00:00
Pavel Yaskevich
5b6c008e2e Merge pull request #21909 from xedin/rdar-47266563
[ConstraintSystem] Skip literal protocols without default types from …
2019-01-16 13:09:36 -08:00
Pavel Yaskevich
e26fc1efff [ConstraintSystem] Skip literal protocols without default types from minimalization
After collecting possible conformances and types for each argument,
`ArgumentInfoCollector` attempts literal protocol minimalization
to reduce the set of possible types argument could assume. Let's
exclude literal protocols without default types like
`ExpressibleByNilLiteral` from consideration by that algorithm.

Resolves: rdar://problem/47266563
2019-01-16 00:35:17 -08:00
Jordan Rose
a628d5d76a Mark another thorough String test as requiring an optimized stdlib (#21835)
This one's taking a pretty long time on simulators, only sometimes
making it under the timeout limit.
2019-01-15 15:37:31 -08:00
Pavel Yaskevich
69c622fc06 Merge pull request #21783 from xedin/rdar-30933988
[AST] `Decl::is*AccessibleFrom` methods should respect access control…
2019-01-14 14:06:44 -08:00
Pavel Yaskevich
13741475f5 Merge pull request #21813 from xedin/rdar-46939892
[TypeChecker] NFC: Add a test-case for rdar://problem/46939892
2019-01-11 19:34:17 -08:00
Pavel Yaskevich
5426e0df9e [AST] Decl::is*AccessibleFrom methods should respect access control flag
Otherwise integrated REPL and other tools like LLDB would produce
incorrect results or crash.

Resolves: rdar://problem/30933988
2019-01-11 17:30:10 -08:00
Pavel Yaskevich
1f5462b310 [TypeChecker] NFC: Add a test-case for rdar://problem/46939892 2019-01-11 17:11:02 -08:00
Pavel Yaskevich
e25d7b3c32 [TypeChecker] NFC: Workaround "expression too complex" in StringNormalization test
Resolves: rdar://problem/47149976
Resolves: rdar://problem/46830020
2019-01-11 11:46:16 -08:00
Jordan Rose
05e5eff482 [test] Run all the benchmarks once as a validation test (#21751)
This is most useful in +Asserts builds of the stdlib, which isn't a
useful configuration for actual benchmarking, but could still uncover
issues in the implementation.
2019-01-10 09:08:33 -08:00
Michael Ilseman
3eb24d44c7 Merge pull request #21725 from milseman/stdlib_optometrist_required
[test] Require -O stdlib for long-running test
2019-01-09 16:57:45 -08:00
Jordan Rose
62c4036f69 Add a regression test for SR-9624 (#21741)
It got fixed somewhere along the way in Swift 5.
2019-01-09 11:06:31 -08:00
Michael Ilseman
509aa6bc14 [test] Require -O stdlib for long-running test 2019-01-08 17:41:42 -08:00
Lance Parker
15aaa1e777 [stdlib]String normalization functions (#21026)
* fast/foreignNormalize functions
2019-01-08 13:55:29 -08:00
Jordan Rose
810a7bcd2d [test] Use -build-module-from-parseable-interface to test overlays (#21687)
Previously we used a manual -emit-module command with a hardcoded set
of arguments, but that didn't work properly for all overlays. This is
much better.
2019-01-07 17:07:06 -08:00
Rintaro Ishizaki
47b987f9e5 Merge pull request #21487 from rintaro/parse-collection-rdar45221238
[Parse] Eliminate backtracking in collection expression parsing
2019-01-07 17:33:15 +09:00
swift-ci
4544476851 Merge pull request #21656 from DougGregor/gsb-source-invalid-source-locs 2019-01-04 21:54:47 -08:00
swift-ci
a31f8c8ef3 Merge pull request #21655 from DougGregor/implements-attr-crash-rdar46678653 2019-01-04 21:15:07 -08:00
Doug Gregor
05fc089af6 [Generic Signature Builder] Sort invalid source locations properly.
Fixes SR-9496 / rdar://problem/46699008.
2019-01-04 20:56:43 -08:00