Commit Graph

7859 Commits

Author SHA1 Message Date
Slava Pestov
6a9790ed30 Sema: Fix compiler_crasher with FixKind::ForceOptional
We were using getRValueType() and getRValueObjectType() when
setting up the constraint, but getRValueType() when simplifying
it. This led to a crash if the type was a single-argument tuple
with a named argument.

Swift SVN r29376
2015-06-15 02:00:46 +00:00
Joe Groff
d7b9ae72aa Sema: Require '.init' when constructing from a dynamic metatype.
This makes it clearer that expressions like "foo.myType.init()" are creating new objects, instead of invoking a weird-looking method. The last part of rdar://problem/21375845.

Swift SVN r29375
2015-06-14 19:50:06 +00:00
Arnold Schwaighofer
f003bc754d validation-test: Make this test pass in optimized mode
Some test cases where assuming to be compiled in Debug assert configuration.

The test relies on return autorelease optimization to happen. This does not
happen reliable in optimize mode.

I ran the test case under the leaks runner and no leaks are reported yet the
object count is positive. This can happen if some objects are still in a
autorelease pool at the time we count them. Which seems to happen.

I surrounded the code with "autoreleasepool {}" and it would pass which confirms
this assumption. I have looked at both the generated LLVM IR and the otool -tvV
asssembly output and did not see anything that would block the return
autorelease optimization (i.e instructions between the returnautorelease
function call and the retain_returnautorelease call) so I don't believe there is
something the compiler could do better.

rdar://21193916

Swift SVN r29369
2015-06-12 18:41:50 +00:00
Slava Pestov
9e1f0c3855 Sema: Fix a compiler_crash when the generic signature is invalid
We might still try to call getDeclaredType(), which would
unexpectedly return nullptr.

Swift SVN r29358
2015-06-10 01:18:21 +00:00
Dmitri Hrybenko
d464a638f2 Annotate 0803-void.swift as passing on Linux
Swift SVN r29350
2015-06-08 08:59:57 +00:00
Slava Pestov
6550c7a858 Sema: Fix subtyping between metatypes and existential metatypes
X.Protocol is an instance of Y.Type only if X conforms to Y. Since X
is a protocol, this is only true if X contains Y and Y is
self-conforming.

Note that this updates some tests that actually contained invalid code.

Fixes <rdar://problem/20915927>.

Swift SVN r29349
2015-06-08 07:59:16 +00:00
Joe Groff
d9fbef1f2f Resolve fixed crashers.
Swift SVN r29348
2015-06-08 05:47:19 +00:00
Joe Groff
58af18748c Expect 'unused initialization' warnings in FixedPointDiagnostics.swift.gyb
Swift SVN r29347
2015-06-08 05:43:22 +00:00
Slava Pestov
fee95a3c06 AST: Fix a compiler_crash
Swift SVN r29341
2015-06-08 04:00:22 +00:00
Slava Pestov
322f58d8b1 Sema: Tighten up existential vs generic type parameter distinction
Rename existentialConformsToSelf() to existentialTypeSupported(). This
predicate is the "protocol has no Self or associated type requirements"
check, which is a looser condition than self-conformance. This was being
tested to see if the user could refer to the protocol via an existential
type.

The new existentialConformsToSelf() now checks for protocol being @objc,
and for the absence of static methods. This is used as part of the
argument type matching logic in matchType() to determine if the
existential can be bound to a generic type parameter.

The latter condition is stricter, for two reasons:

1) We allow binding existentials to multiple type parameters all sharing
   the same generic type parameter T, so we don't want the user to be
   able to see any static methods on T.
2) There is an IRGen limitation whereby only existentials without witness
   tables can be passed in this manner.

Using the above, the representsNonTrivialGenericParameter() function
has been renamed to canBindGenericParamToExistential(). It now allows
an existential type to be bound to a generic type parameter only under
the following circumstances:

A) If the generic type parameter has no conformances, the match is allowed.

B) If the generic type parameter has at least one conformance, then all
   of the conformances on the generic type parameter must be
   existentialConformsToSelf() (condition 1 above), and all conformances
   on the existential must be @objc (condition 2 above).

Fixes <rdar://problem/18378390> and <rdar://problem/18683843>, and lays
the groundwork for fixing a few other related issues.

Swift SVN r29337
2015-06-07 10:16:21 +00:00
Dmitri Hrybenko
41934b5433 stdlib: Add some basic array bridging tests
Swift SVN r29307
2015-06-04 20:13:11 +00:00
Dmitri Hrybenko
572b08bd43 Dictionary test: use more precise autorelease pool placement
Swift SVN r29296
2015-06-04 09:06:17 +00:00
Dmitri Hrybenko
8387fc45b5 StdlibUnittest: add a facility to activate autorelease pools only on platforms that don't implement the return-autoreleased optimization
Swift SVN r29295
2015-06-04 09:06:16 +00:00
Arnold Schwaighofer
edf20fb43a Change test to not depend on being compiled with -Onone
Swift SVN r29288
2015-06-04 01:55:49 +00:00
Arnold Schwaighofer
e0d434ff8e This fails in optimized mode
rdar://212311525

Swift SVN r29283
2015-06-03 23:28:54 +00:00
Arnold Schwaighofer
b9b00326f6 This fails in optimized mode
rdar://21231163

Swift SVN r29282
2015-06-03 23:28:54 +00:00
Arnold Schwaighofer
2c617bf75b This test case assumes to be compiled without optimizations
Swift SVN r29281
2015-06-03 23:28:53 +00:00
Arnold Schwaighofer
ee0a1d1a58 More executable tests in validation-test
Swift SVN r29279
2015-06-03 23:28:45 +00:00
Arnold Schwaighofer
4d4329b0e0 Add executable_test to the validation test suite
Swift SVN r29278
2015-06-03 23:28:43 +00:00
Dmitri Hrybenko
cca4f4e3ff Revert "stdlib: Add some basic array bridging tests"
This reverts commit 29268.  The tests don't pass on the 32-bit
simulator.

Swift SVN r29273
2015-06-03 05:07:42 +00:00
Dmitri Hrybenko
6b9e73aa09 stdlib: Add some basic array bridging tests
Swift SVN r29268
2015-06-03 03:10:06 +00:00
Dmitri Hrybenko
04549ce1d5 Dictionary test: add more assertions
Swift SVN r29267
2015-06-03 03:10:05 +00:00
Slava Pestov
0c88c13c0d IRGen: Brazenly nuke -enable-dynamic-value-type-layout flag
The last remaining case was apparently @objc generic classes, which
seem to work now.

Also nuke the IRGen/unimplemented_objc_generic_class.swift test,
this is now implemented and we have other tests that test this
functionality.

Swift SVN r29260
2015-06-03 00:01:29 +00:00
Dmitri Hrybenko
dc29fca37f Update the Dictionary test for a performance improvement in Foundation
Swift SVN r29254
2015-06-02 20:59:15 +00:00
Dmitri Hrybenko
854a197845 Update to the new GameplayKit API
Swift SVN r29253
2015-06-02 20:59:14 +00:00
Arnold Schwaighofer
6c936235d4 This test no longer fails
rdar://21204610

Swift SVN r29250
2015-06-02 20:58:14 +00:00
Arnold Schwaighofer
45686daeb4 This test case fails with an optimized stdlib on armv7
rdar://21204610

Swift SVN r29246
2015-06-02 18:52:35 +00:00
Jordan Rose
2cd2d9ceb2 [test] Remove XFAIL lines from still-crashing compiler_crashers.
This is handled by the directory's lit.local.cfg.

Swift SVN r29238
2015-06-02 17:45:20 +00:00
Arnold Schwaighofer
9ac6b9bd83 This is an executable test
Swift SVN r29235
2015-06-02 16:16:07 +00:00
Greg Parker
d97b76e0a1 [test] Un-XFAIL a test that no longer fails on asan.
Swift SVN r29231
2015-06-02 09:40:14 +00:00
Chris Lattner
b6a15d6828 My error recovery fix improved types, likely because something wasn't handling a tok::invalid correctly.
Swift SVN r29225
2015-06-02 05:02:53 +00:00
Arnold Schwaighofer
bd9108157c This test currently fails in optimized mode
rdar://21193916

Swift SVN r29220
2015-06-02 02:09:49 +00:00
Dmitri Hrybenko
37135f441b XCTest requires objc_interop
Swift SVN r29198
2015-06-01 01:32:46 +00:00
Dmitri Hrybenko
29ec6ab6b5 Re-enable the XCTest overlay for OSX
And add the first smoketest for the XCTest overlay to prevent
regressions in future.

Swift SVN r29197
2015-06-01 01:09:31 +00:00
Doug Gregor
bf310f5e1a Compute outer generic parameters even when 'self' already has a type.
Resolves a few compiler crashes on invalid. One could imagine this
triggering on well-formed code, but I was unable to form such a test
case.

Swift SVN r29149
2015-05-29 17:54:25 +00:00
Ted Kremenek
dad92b0084 Revert "IRGen: Brazenly nuke -enable-dynamic-value-type-layout flag"
Speculatively reverting because the iOS bots are broken.

Swift SVN r29145
2015-05-29 14:11:25 +00:00
Slava Pestov
9da369b5ba IRGen: Brazenly nuke -enable-dynamic-value-type-layout flag
The last remaining case was apparently @objc generic classes, which
seem to work now.

Also nuke the IRGen/unimplemented_objc_generic_class.swift test,
this is now implemented and we have other tests that test this
functionality.

Swift SVN r29138
2015-05-29 06:19:06 +00:00
Doug Gregor
a3f01190f3 Fill in nested types of an opened existential type.
We only attempt to access such nested types in ill-formed code, but
this helps maintain AST invariants. Fixes rdar://problem/20593294 and
resolves 18 compiler crashers.

Swift SVN r29135
2015-05-29 05:47:28 +00:00
Dmitri Hrybenko
ffe26aa69c stdlib: dissolve the Array.swift test in other tests
Swift SVN r29129
2015-05-29 01:33:07 +00:00
Jordan Rose
ceedc93715 [test] Remove spurious -sdk passed to %target-sil-opt.
Thanks, Dmitri!

Swift SVN r29127
2015-05-29 00:32:16 +00:00
Jordan Rose
5baee3e3bf [test] verify_all_overlays.sil doesn't require ObjC interop.
(because it doesn't name any specific overlays)

Swift SVN r29126
2015-05-29 00:21:41 +00:00
Jordan Rose
52947de17f [test] Update parse_stdlib_* "automatically generated from" header.
...since I renamed the parent directory. Thanks, Dmitri!

Swift SVN r29125
2015-05-29 00:21:37 +00:00
Jordan Rose
ac5fa6740c [Serialization] Only serialize witness tables for the current file or module.
Otherwise, we end up with duplicates.

rdar://problem/21145040

Swift SVN r29121
2015-05-28 23:33:08 +00:00
Doug Gregor
bb35361b5b Add test for rdar://problem/20508671.
Swift SVN r29120
2015-05-28 23:24:26 +00:00
Doug Gregor
a7225aa51c Add compiler crasher from rdar://problem/19519590.
Swift SVN r29119
2015-05-28 23:24:23 +00:00
Dmitri Hrybenko
67624d0521 Add a testcase for rdar://20256475
Swift SVN r29118
2015-05-28 23:06:16 +00:00
Doug Gregor
6a0382caf1 Add test from rdar://problem/20270240.
Swift SVN r29110
2015-05-28 20:20:11 +00:00
Doug Gregor
3b7c0d446a Switch unqualified lookup over to the LookupResultBuilder.
Unifies the handling of witnesses in unqualified and qualified name
lookup, mostly.

Swift SVN r29081
2015-05-27 21:29:55 +00:00
Greg Parker
7a47bab351 [test] Un-XFAIL a fixed compiler crasher that now works under asan too.
Swift SVN r29038
2015-05-26 22:43:15 +00:00
Ben Langmuir
190208b187 Update compiler crashers after r29031
The aforementioned commit didn't really fix the problem, but it happened
to avoid the crash, so I've tweaked the tests to continue crashing.  In
order to keep in sync with upstream practical swift, I renamed the
tweaked tests and copied the original ones into "fixed".

Swift SVN r29033
2015-05-26 17:48:07 +00:00