Commit Graph

6090 Commits

Author SHA1 Message Date
Holly Borla
4096a62b2a [ConstraintSystem] Don't update the work list when merging type variables
in addJoinConstraint.
2020-08-10 19:56:00 -07:00
Mishal Shah
ac6683994a [Disable] SILOptimizer test (66807959) 2020-08-10 17:22:26 -07:00
Robert Widmann
aada983ceb Replace supersuperclassConformsTo
This more powerful primitive is capable of
1) Detecting invalid classes
2) Detecting invalid superclasses
3) Detecting circularity in inheritance hierarchies

The attached crasher demonstrates the reason we need to validate all of these predicates. Simply put, a circular class hierarchy is always going to report the superclass conforms to any protocol with a declaration in the source. Leveraging this, one could construct any circular class hierarchy, and a conformance to Codable would immediately crash because we got as far as trying to build a CodingKeys enum with an absolutely nonsensical structure.

This also has the added benefit of de-complecting an enormous amount of codable conformance code.

rdar://66588925
2020-08-10 14:38:29 -07:00
Stephen Canon
457b9990e9 Add checks that the endpoints of partial ranges are not-NaN. (#33378)
We can't actually check for NaN (because the notion doesn't exist for Comparable), but we can require that the endpoint is non-exceptional by checking if it equals itself.
2020-08-10 14:06:46 -04:00
Mishal Shah
bc2a8f41c1 Merge pull request #33354 from apple/shahmishal/codesign-tests
[Tests] Codesign the binary before executing the test
2020-08-07 19:33:20 -07:00
Holly Borla
9e818233f0 Merge pull request #33296 from hborla/merge-joined-literal-typevars
[ConstraintSystem] Add a type variable merging heuristic to addJoinConstraint
2020-08-07 09:07:19 -07:00
Mishal Shah
a3cd8bc9e9 [Tests] Codesign the binary before executing the test 2020-08-07 00:26:07 -07:00
Holly Borla
989a432898 [NFC] Update array literal type checking performance validation tests. 2020-08-06 12:30:45 -07:00
Suyash Srijan
3502e07bf0 [Mangling] Add a new mangling for opaque return type to use when mangling an ObjC runtime name (#33035)
* [Mangling] Add a new mangling to represent opaque return type for ObjC runtime name

* [Docs] Add the new 'Qu' mangling to 'Mangling.rst' document

* [Test] Update test invocation arguments
2020-08-05 05:03:45 +01:00
Erik Eckstein
5f3e79b84e StringOptimization: bug fixes
Fix some bugs in the optimization and in the test files.

rdar://problem/66283894
2020-07-30 11:32:39 +02:00
Augusto Noronha
a6e2f8b7a0 Conditionalize 'num_extra_inhabitants' in 64 bit platforms' tests (#33136) 2020-07-29 18:49:58 -07:00
Slava Pestov
6364a99123 Merge pull request #33176 from slavapestov/apply-generic-arguments-cleanup
Clean up declaration checker's modeling of generic arguments and parameter lists
2020-07-29 11:03:14 -04:00
Nate Cook
498969f64e XFAIL SILOptimizer/large_string_array.swift.gyb (#33157) 2020-07-28 11:09:57 -05:00
Slava Pestov
769c4c1911 Sema: Fix some crashes with invalid nesting of extensions and protocols
Make sure we consistently use getParentForLookup() and not getParent()
when looking at generic DeclContexts. This is because an extension or
protocol that is nested inside of another generic context must never
inherit generic parameters from the parent context.

We already had this invariant enforced in some places, but now that we
do it more consistently we can fix more crashes of this kind.

Fixes <rdar://problem/58813746>, <https://bugs.swift.org/browse/SR-13004>.
2020-07-28 02:07:16 -04: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