Commit Graph

5777 Commits

Author SHA1 Message Date
Nate Cook 498969f64e XFAIL SILOptimizer/large_string_array.swift.gyb (#33157) 2020-07-28 11:09:57 -05:00
Augusto Noronha 0f8613711d Enable validation reflection tests passing on Linux (#33134) 2020-07-27 14:36:19 -07:00
Mishal Shah 2b18b5067c [XFAIL] Sema/SwiftUI/rdar57201781.swift and Constraints/trailing_closures_objc.swift to support Xcode 12 beta 3 2020-07-26 23:24:26 -07:00
Augusto Noronha 3cb8f9b6fc Add entrypoints to the runtime that exposes metadata necessary for reflection tests on Linux (#32339) 2020-07-24 15:26:15 -07:00
Andrew Trick 4b6641f15f Merge pull request #32860 from buttaface/skip-build
[build] Fix --skip-build-llvm so that its minimal targets, like tblgen, are still built
2020-07-20 20:43:18 -07:00
Butta c969814a11 [build] Fix --skip-build-llvm so that its minimal targets, like tblgen, are still built 2020-07-18 03:45:17 +05:30
Butta 09e30ef00c [test] Enable standalone_build feature properly and fix three tests
Two tests were mislabeled and a third needed its output reordered.
2020-07-18 03:10:31 +05:30
Slava Pestov 2a0c8d1090 GSB: Fix use-after-free error when vending ResolvedType
The maybeResolveEquivalenceClass() method can deallocate equivalence
classes, because it calls updateNestedTypeForConformance(), which
calls addSameTypeRequirement().

Therefore, the EquivalenceClass stored inside a ResolvedType could
become invalid across calls to maybeResolveEquivalenceClass().

This was a problem in one place in particular, when adding a new
same-type constraint between two type parameters.

Fix this by not caching the equivalence class of a PotentialArchetype
in the ResolvedType implementation. The only time an equivalence class
is now stored is when returning an unresolved type, which is acted
upon immediately.

Fixes <https://bugs.swift.org/browse/SR-12812>, <rdar://problem/63422600>.
2020-07-16 23:31:33 -04:00
Rintaro Ishizaki 802754d432 Merge pull request #32900 from rintaro/ide-completion-ccexprremover-rdar65556791
[CodeCompletion] Fix a crash in CCExprRemover
2020-07-15 12:46:10 -07:00
Rintaro Ishizaki f7fc1ed7b5 [CodeCompletion] Fix a crash in CCExprRemover
- Handle cases where getArgumentLabelLocs().size() == 0
- Add some assertions to verify invariants
- Explicit handling of 'llvm::Optional' for 'getUnlabeledTrailingClosureIndex()'
- Avoid walking into nodes after the removing happens

rdar://problem/65556791
2020-07-15 09:56:20 -07:00
Nate Chandler 0113849396 [Test] Disable two tests that hang asan bots.
The following tests are disabled here:

    compiler_crashers_2/0208-sr8751.swift
    compiler_crashers_2/0207-sr7371.swift

rdar://problem/65571199
2020-07-14 16:23:38 -07:00
Saleem Abdulrasool 7ec46f0d6d Merge pull request #32848 from compnerd/divide-and-conquer
validation: explicitly use integral division
2020-07-14 11:15:53 -07:00
Saleem Abdulrasool 8d5c010980 validation: explicitly use integral division
Division behaviour changed between Python 2 and Python 3.  Explicitly
indicate that we wish to use integral division here.
2020-07-13 23:46:00 +00:00
Saleem Abdulrasool 4cd81213c0 validation: make UnsafeBufferPointer Python3 friendly
The `<>` operator does not work in Python 3.  Switch it out for `!=`.
2020-07-13 15:56:07 +00:00
Nate Chandler 086e4a356e [Test] Don't use os stdlib for Runtime/rdar64672291.swift. 2020-07-11 09:30:13 -07:00
Robert Widmann 50c4b3fbf1 Merge pull request #32822 from CodaFi/totally-spaced-out
Handle Boolean Patterns Matching Against Invalid Constructor Forms
2020-07-10 23:20:25 -07:00
Robert Widmann 4369a71a03 Handle Boolean Patterns Matching Against Invalid Constructor Forms
The Space Engine maintains as one of its invariants that the AST it is
handed must at least typecheck. When swift typechecks patterns, the only
case one is allowed to form a Boolean pattern is when a literal is
expected, and the corresponding type of the pattern clause is exactly
Bool. This precludes the use of other types, including
ExpressibleByBooleanLiteral types, from matching. Thus, this code path
was never hit. That is, until we accidentally lifted the restriction on
enum case base name overloading too early. Now, it is possible for the
space engine to see the same constructor head that has subspaces with
different argument types. The space engine is relatively tolerant of
this bizarre situation, but in this one narrow case it was not.

This patch has a narrow fix to add the missing case to the
space engine. In the long term, we need to actually finish SE-0155 which
will make this crash structurally impossible once again.

Resolves rdar://65229620
2020-07-10 14:23:12 -07:00
Nate Chandler c6812cee68 [Test] Mark executable test appropriately. 2020-07-10 06:21:11 -07:00
Dmitri Gribenko 2e0237701c Merge pull request #32783 from gribozavr/improve-synthesized-initializers-test
Rename synthesized initializer test to follow the pattern
2020-07-09 23:21:15 +02:00
Slava Pestov a405da436e Merge pull request #32776 from slavapestov/fix-circularity-crash
Sema: Fix crash on circular reference in checkContextualRequirements()
2020-07-09 09:34:40 -04:00
Dmitri Gribenko 3de9e5ac77 Rename synthesized initializer test to follow the pattern
And also removed a test that is semantically a duplicate of the
synthesized initializer test.
2020-07-09 12:11:08 +02:00
swift-ci a37593a214 Merge pull request #32772 from nate-chandler/rdar50648519 2020-07-08 20:48:12 -07:00
Slava Pestov 1f5433fe51 Add regression test for rdar://64759168 2020-07-08 23:08:40 -04:00
Slava Pestov 94e9263699 Sema: Fix crash on circular reference in checkContextualRequirements()
The call to getGenericSignature() might return nullptr if we encounter
a circular reference.

Fixes <rdar://problem/64992293>.
2020-07-08 23:08:39 -04:00
Nate Chandler caca83e9e1 [Test] Un-XFAIL ParseableInterface/verify_all_overlays.py.
The test is passing now--un-XFAIL it.

rdar://problem/50648519
2020-07-08 18:01:46 -07:00
nate-chandler 80a5fb262a Merge pull request #32695 from nate-chandler/rdar64672291
[Runtime] Let existential types satisfy superclass requirements.
2020-07-08 09:37:57 -07:00
Anthony Latsis 2133fe27df Sema: Have TypeResolution accept an unbound generic type opener function 2020-07-08 13:39:34 +03:00
Holly Borla 063d420e50 Merge pull request #32672 from hborla/property-wrapper-diagnostics
[Property Wrappers] Improve diagnostics for property wrappers initialized out-of-line
2020-07-07 19:07:55 -07:00
Nate Chandler 9e6d68e45b [Runtime] Let existential types satisfy superclass requirements.
Previously, when an attempt was made to instantiate a generic metadata
whose argument was constrained to subclass a superclass Super with an
existential type E that had a superclass constraint to a subclass Sub of
that same superclass Super, the instantiation would fail at runtime,
despite the fact that the generic instantiation was allowed to
type-check.

The result was a runtime failure to instantiate generic metadata
resulting eventually in a crash.

Here, handling for that situation is added.  When checking generic
requirements at runtime, when a superclass requirement is encountered,
an existential type is checked for.  If that existential type has a
superclass constraint and if that superclass constraint is a subclass of
the superclass requirement, the check is determined to be satisfactory.

rdar://problem/64672291
2020-07-02 17:19:55 -07:00
Mishal Shah 84489d87b2 [Apple Silicon] Mark several tests that require the Swift interpreter accordingly 2020-07-02 16:26:10 -07:00
Holly Borla 9b4f1f0935 [NFC] Update validation tests with new property wrapper diagnostics 2020-07-02 14:47:45 -07:00
Holly Borla b871528179 Merge pull request #32524 from OnyekachiSamuel/fix-confusing-protocol-diagnostic
[Diagnostics] Fix Confusing Protocol Diagnostic
2020-07-02 13:01:19 -07:00
Onyekachi Ezeoke a08f421c1a fix failing tests 2020-07-02 12:09:07 +01:00
Onyekachi Ezeoke ff26a06257 fix broken test 2020-07-02 03:13:10 +01:00
Robert Widmann 50159d15b7 [Gardening] Use Vendor=apple Where Possible
This simplifies the usual bundle of OS checks

OS=macosx || OS=ios || OS=tvos || OS=watchos

into

VENDOR=apple

which was added in apple/swift#27307
2020-06-30 23:03:01 -07:00
Robert Widmann cddf73ecdb [Gardening] Clean Up OS-Test Patterns Across The Codebase
Clean up a few general patterns that are now obviated by canImport

This aligns more generally with the cleanup that the Swift Package
Manager has already done in their automated XCTest-plumbing tool in
apple/swift-package-manager#1826.
2020-06-30 22:55:58 -07:00
Slava Pestov ffb59e78bb Merge pull request #32610 from slavapestov/regression-test-sr11030
Add regression test for https://bugs.swift.org/browse/SR-11030 / rdar://problem/52266834
2020-06-30 00:50:51 -04:00
Slava Pestov faa06bfd87 Merge pull request #32581 from slavapestov/cached-emitted-members-request
Deterministically order class members for emission
2020-06-30 00:47:33 -04:00
Slava Pestov 422fd41396 Sema: Fix assertion when synthesizing Codable with an IUO stored property
Fixes <https://bugs.swift.org/browse/SR-13118>.
2020-06-29 22:27:38 -04:00
Slava Pestov 63bf06d959 Add regression test for https://bugs.swift.org/browse/SR-11030 / rdar://problem/52266834 2020-06-29 22:26:16 -04:00
Slava Pestov 31a78590a8 ASTMangler: Fix assertion when mangling invalid identifiers
We sometimes need to mangle invalid identifiers, for example when sorting
declarations in EmittedMembersRequest. Make sure this doesn't assert.
2020-06-29 22:17:56 -04:00
swift-ci 5300dc2799 Merge pull request #32534 from zoecarver/fix/cxx/constructor-return-stmt 2020-06-26 16:27:15 -07:00
Xi Ge fa53ba84da test: xfail validation-test/Sanitizers/witness_table_lookup.swift 2020-06-26 09:50:28 -07:00
Xi Ge 5edaae37a2 test: xfail validation-test/Sanitizers/tsan-type-metadata.swift 2020-06-26 09:50:28 -07:00
Xi Ge eade392422 test: xfail validation-test/StdlibUnittest/RaceTest.swift 2020-06-26 09:50:17 -07:00
zoecarver 096777eda7 [cxx-interop] Do not give the default C++ constructor's return statement a result.
The default C++ object constructor assigns the newly created object out of the function so, it should not return a value. Returning a value will trigger SILGen assertions.
2020-06-24 14:02:02 -07:00
Karoy Lorentey da242bd2d4 [SDK] Remove obsolete overlay code 2020-06-22 15:43:39 -07:00
Mishal Shah 272c466e47 Update master to build with Xcode 12 beta 2020-06-22 15:43:20 -07:00
Slava Pestov 71e267d5b1 GSB: Teach 'derived via concrete' computation about superclass constraints
Under certain circumstances, introducing a concrete same-type or
superclass constraint can re-introduce conformance constraints
which were previously redundant.

For example, consider this code, which we correctly support today:

protocol P {
  associatedtype T : Q
}

protocol Q {}

class SomeClass<U : Q> {}

struct Outer<T> where T : P {
  func inner<U>(_: U) where T == SomeClass<U>, U : Q {}
}

The constraint 'T == SomeClass<U>' makes the outer constraint
`T : P' redundant, because SomeClass already conforms to P.
It also introduces an implied same-type constraint 'U == T.T'.

However, whereas 'T : P' together with 'U == T.T' make 'U : Q'
redundant, the introduction of the constraint 'T == SomeClass<U>'
removes 'T : P', so we re-introduce an explicit constraint 'U : Q'
in order to get a valid generic signature.

This code path did the right thing for constraints derived via
concrete same-type constraints, but it did not handle superclass
constraints.

As a result, this case was broken:

struct Outer<T> where T : P {
  func inner<U>(_: U) where T : SomeClass<U>, U : Q {}
}

This is the same example as above, except T is related via a
superclass constraint to SomeClass<U>, instead of via a concrete
same-type constraint.

The subtlety here is that we must check if the superclass type
actually conforms to the requirement source's protocol, because it
is possible to have a superclass-constrained generic parameter
where some conformances are abstract. Eg, if SomeClass did not
conform to another protocol P2, we could write

func foo<T, U>(_: T, _: U) where T : SomeClass<U>, T : P2 {}

In this case, 'T : P2' is an abstract conformance on the type 'T'.

The common case where this would come up in real code is when you
have a class that conforms to a protocol with an associated type,
and one of the protocol requirements was fulfilled by a default in
a protocol extension, eg:

protocol P {
  associatedtype T : Q

  func foo()
}

extension P {
  func foo() {}
}

class ConformsWithDefault<T : Q> : P {}

The above used to crash; now it will type-check correctly.

Fixes <rdar://problem/44736411>, <https://bugs.swift.org/browse/SR-8814>..
2020-06-21 23:42:10 -04:00
Slava Pestov 989f4e119f Add regression test for https://bugs.swift.org/browse/SR-1329 2020-06-19 16:32:05 -04:00