Commit Graph

7628 Commits

Author SHA1 Message Date
Doug Gregor
70968a38fc Use the iterative type checker for TypeChecker::resolveInheritedProtocols.
Swift SVN r32564
2015-10-09 17:18:42 +00:00
Doug Gregor
f247447f03 Iterative type checker: compute inherited protocols of a protocol.
Introduce a type check request for computing inherited protocols and
start using it in a few places.

Swift SVN r32562
2015-10-09 17:18:40 +00:00
Doug Gregor
2feed84c91 Sketch out the interface to an iterative, lazy type checker.
This is all effectively NFC, but lays out the shape of the iterative
type checker: requests are packaged up in TypeCheckRequest, we can
check whether the request has been satisfied already (isSatisfied),
enumerate its dependencies (enumerateDependenciesOf) in terms of other
TypeCheckRequests, and satisfy a request (satisfy).

Lazily-computed semantic information is captured directly in the
AST, but has been set aside in its own structure to allow us to
experiment with moving it into a lookaside table.

The only request that exists now is to type-check the superclass of
the given class. It currently performs unhealthy recursion into the
existing type checker. As we detangle dependencies, this recursion
between the IterativeTypeChecker and the TypeChecker can go away.

Swift SVN r32558
2015-10-09 17:18:36 +00:00
David Farler
fb2381124b Fix CoreMedia CMTimeRange overlay != operator
This was ... returning the same thing as the == operator.

Also, integrate the CoreMedia overlay tests from
rdar://problem/20926198, which caught this problem, and port it
to StdlibUnittest.

Swift SVN r32484
2015-10-07 01:27:36 +00:00
Doug Gregor
34106f7f32 Include the Self type of a protocol type in the list of "all" generic arguments.
It's never bound, but this maintains invariants better and fixes a
number of crashes.

Swift SVN r32430
2015-10-04 06:18:15 +00:00
Dmitri Hrybenko
6536edd68c stdlib: fix coding style
Swift SVN r32425
2015-10-03 21:13:15 +00:00
Doug Gregor
98dadc9800 Teach resolveTopLevelIdentTypeComponent not to modify the component.
Instead, always return the computed Type and let the caller deal with
it. NFC except for accidentally fixing a crasher.

Swift SVN r32377
2015-10-01 20:17:24 +00:00
Arnold Schwaighofer
3e984d25d9 Change test name - we test non unique arrays here
Swift SVN r32282
2015-09-28 21:20:22 +00:00
Arnold Schwaighofer
599a438015 Don't force to grow the buffer everytime we make it unique
rdar://22873620

Swift SVN r32280
2015-09-28 20:47:23 +00:00
Mark Lacey
517723dbe9 Add -enable-sil-verify-all to sil-opt tests.
Also remove -verify from almost all of them, since only two actually
have expected diagnostic output that is tested.

Swift SVN r32198
2015-09-24 07:25:15 +00:00
Slava Pestov
69981a63eb Fix a handful of compiler_crashers were failing on OS X but passing on Linux
I'm too lazy to XFAIL: these, so fix the crash instead.

Swift SVN r32188
2015-09-23 22:27:36 +00:00
Slava Pestov
28c8d0b30d Remove duplicate compiler_crashers
Swift SVN r32187
2015-09-23 22:27:26 +00:00
Slava Pestov
864cc29ccf Remove timeout tests for now
rdar://22812658 tracks re-enabling these.

Swift SVN r32171
2015-09-23 00:59:06 +00:00
Slava Pestov
9fcf7f1bb9 Import latest compiler crashers and regressions from practicalswift
Swift SVN r32157
2015-09-22 21:08:21 +00:00
Doug Gregor
ca3e3968c6 Add back two recently-fixed tests that accidentally got unstaged.
Swift SVN r32019
2015-09-16 23:50:29 +00:00
Doug Gregor
7a3f05a07a Reduce dependency on IdentTypeRepr::getBoundType().
Having bound types in TypeReprs causes trouble in several places
(mostly involving type-checking of generics), and doesn't really fit
with TypeReprs being a mostly syntactic construct. Eliminate some code
paths using getBoundType(), and make the others do the same thing for
getBoundDecl() and getBoundType(). As part of the latter, provide
TypeBase::getDirectlyReferencedTypeDecl() to more easily map from type
to the named declaration.

Swift SVN r32018
2015-09-16 23:25:19 +00:00
Dmitri Hrybenko
0a22034d65 GameplayKit overlay: add explicit tvOS availability
rdar://22707844

Patch by Dave Schaefgen.

Swift SVN r31970
2015-09-15 20:41:18 +00:00
Dmitri Hrybenko
67944589d6 stdlib: improve index invalidation guarantees for removeFirst()
Slice types that are RangeReplaceable (like ArraySlice) now slice
themselves in removeFirst().  Previously, these types were picking up
the wrong default implementation, and they were going through
replaceRange(), which caused all indices to be invalidated.  The new
implementation preserves all indices.

rdar://22536664

Swift SVN r31918
2015-09-12 04:35:51 +00:00
Chris Lattner
cbf145482a This diagnostic improved causing the validation test to fail. Instead of nuking the
error lines outright, move it to the non-validation suite.


Swift SVN r31749
2015-09-07 23:26:41 +00:00
Jordan Rose
99febda07f Simplify the CMake-generated lit.py invocation.
Now it's down to what I use myself, plus the --xunit-xml-output flag.
I also threw out a fair number of options we weren't using.

Swift SVN r31646
2015-09-03 00:51:25 +00:00
Arnold Schwaighofer
eb3d5e4d4a Revert "stdlib: Move the darwin String implementation over to use the ICU library."
Revert "Add test cases to exercise the native String vs cocoa buffer String path."
Revert "stdlib: Add back a test I removed"
Revert "stdlib: Fix hasPrefix,hasSuffix tests"
Revert "stdlib: Add documentation for the cached ascii collation tables"

This reverts commit 31493, 31492, 31491, 31490, 31489.

There are linking errors in SwiftExternalProjects (we probably have to link
against libicucore somewhere).

Swift SVN r31543
2015-08-27 21:02:32 +00:00
Dmitri Hrybenko
9b1ff7d92e stdlib: add a test that shows how to repeatedly call indexOf()
rdar://19753556

Swift SVN r31517
2015-08-27 01:51:42 +00:00
Arnold Schwaighofer
e1131ce3ee stdlib: Add back a test I removed
Reapply of 31476.

Swift SVN r31491
2015-08-26 15:14:20 +00:00
Arnold Schwaighofer
502f1e3de1 stdlib: Move the darwin String implementation over to use the ICU library.
Reapply of 31474 with a fix in _compareCocoaBuffer to use the bufferSizeRhs
variable instead of bufferSizeLhs for the right hand side buffer.

We no longer create intermediate NSString copies to compare and hash swift
Strings. Instead we call directly into the ICU library.

I measured a 1.2 to 2x improvement on dictionary benchmarks as a result of this.
The SuperChars benchmark is also about 1.2x faster because of this.

Pure ASCII comparison has gotten a little bit slower (20% on a pure comparison
micro-benchmark) because we no longer do a memcmp. Doing a memcmp on ASCII is
not the same as the default unicode collation. Instead we have to a string scan.
The default unicode collation does not order like ASCII does and ignores
characters (for example the \0 character).

rdar://18992510

Swift SVN r31489
2015-08-26 15:14:18 +00:00
Arnold Schwaighofer
2d8f29e710 Revert "stdlib: Fix hasPrefix,hasSuffix tests"
Revert "stdlib: Add back a test I removed"
Revert "Add test cases to exercise the native String vs cocoa buffer String path."
Revert "stdlib: Move the darwin String implementation over to use the ICU library."

This reverts commit r31477, r31476, r31475, r31474.

Commit r31474 broke the ASAN build.

Swift SVN r31488
2015-08-26 13:09:03 +00:00
Arnold Schwaighofer
2588f44d83 stdlib: Add back a test I removed
Swift SVN r31476
2015-08-26 03:57:24 +00:00
Arnold Schwaighofer
5a25a00d1f stdlib: Move the darwin String implementation over to use the ICU library.
We no longer create intermediate NSString copies to compare and hash swift
Strings. Instead we call directly into the ICU library.

I measured a 1.2 to 2x improvement on dictionary benchmarks as a result of this.
The SuperChars benchmark is also about 1.2x faster because of this.

Pure ASCII comparison has gotten a little bit slower (20% on a pure comparison
micro-benchmark) because we no longer do a memcmp. Doing a memcmp on ASCII is
not the same as the default unicode collation. Instead we have to a string scan.
The default unicode collation does not order like ASCII does and ignores
characters (for example the \0 character).

rdar://18992510

Swift SVN r31474
2015-08-26 03:36:59 +00:00
Arnold Schwaighofer
3ec9325c58 stdlib: Don't hash in the length of the string
Some characters are not considered when comparing strings. Hashing in the length
would cause a difference of hash values in equal strings.

Swift SVN r31468
2015-08-26 02:00:20 +00:00
Arnold Schwaighofer
41119cb80b stdlib: Don't crash on strings that require a bigger buffer on normalization.
This is currently a linux only issue.

Swift SVN r31467
2015-08-26 02:00:19 +00:00
Jordan Rose
babdb9e9f9 Delay loading the witnesses of a protocol conformance.
Apart from being general compile-time goodness, this helps break a
circularity issue involving serialization cross-references and the
Clang importer.

The test is being added to validation-tests because it relies on
several levels of non-laziness in the compiler, all of which we'd
like to fix. It's making sure we don't regress here, but it isn't
actually verifying this change in particular.

rdar://problem/22364953

Swift SVN r31455
2015-08-25 21:47:18 +00:00
Dmitri Hrybenko
217ef5aa12 stdlib: fix legacy Mirror for ArraySlice
The mirror wasn't adjusted to account for non-zero-based indices of
ArraySlice.

rdar://problem/22373053

Swift SVN r31409
2015-08-22 08:04:58 +00:00
Doug Gregor
cab320296d Stop recording protocol lists in nominal types.
The conformance lookup table is responsible for answering queries
about the protocols to which a particular nominal type conforms, so
stop storing (redundant and incorrect) protocol lists on the ASTs for
nominal types. Protocol types still store the list of protocols that
they inherit, however.

As a drive-by, stop lying about the number of bits that ProtocolDecl
uses on top of NominalTypeDecl, and move the overflow bits down into
ProtocolDecl itself so we don't bloat Decl unnecessarily.

Swift SVN r31381
2015-08-21 17:51:23 +00:00
Doug Gregor
f0fcd594c0 Stop using TypeDecl::Protocols within abstract type parameters.
More baby steps toward sinking protocol lists down into
NominalTypeDecl. Fixes another 12 crashers along the way.

Swift SVN r31333
2015-08-19 06:42:30 +00:00
Doug Gregor
f898887894 Eliminate getConformsTo() callback from the archetype builder.
The getConformsTo() callback was responsible for forcing the
collection of the requirements directly placed on an associated type,
which then get added to the archetype builder. This resulted in an
unhealthy dependency on the list of protocols attached to TypeDecl
(which should go away). Instead, retrieve the requirements from the
associated type's archetype (once it's been computed) or directly from
its list of "inherited" types (while we're building the generic
signature for the protocol itself).

Swift SVN r31332
2015-08-19 06:42:27 +00:00
Doug Gregor
dd93c6390b Teach name lookup to cope with missing archetypes on associated types.
Name lookup shouldn't even depend on such semantic information, but
this fixes 13 crashers.

Swift SVN r31331
2015-08-19 06:42:23 +00:00
Dmitri Hrybenko
ff1680c7ea stdlib: expand the test boilerplate from Slice.swift.gyb
This test organization allows running more tests in parallel.

Part of rdar://22297353

Swift SVN r31287
2015-08-18 03:54:13 +00:00
Dmitri Hrybenko
8311c05461 stdlib: add a default implementation for MutableCollection.subscript().set
rdar://20722366

Swift SVN r31241
2015-08-14 03:12:23 +00:00
Dave Abrahams
5f56f104a7 [stdlib] de-gyb a test
Swift SVN r31215
2015-08-13 17:41:43 +00:00
Chris Lattner
1f0bd30fbe add the missing note.
Swift SVN r31212
2015-08-13 06:08:32 +00:00
Chris Lattner
e922008fa4 update test for diagnostic changes, not handling sametype constraints well is a known issue.
Swift SVN r31209
2015-08-13 05:39:23 +00:00
Dmitri Hrybenko
ee20926b20 stdlib: rename join() to joinWithSeparator()
rdar://22022419, rdar://21474222

Swift SVN r31188
2015-08-12 21:16:38 +00:00
Chris Lattner
54ace2547f fix test, this actually successfully completes now.
Swift SVN r31137
2015-08-11 18:27:21 +00:00
Chris Lattner
654cb861ed fix <rdar://problem/21886435> Swift compiler crashes on "()=()"
... which was just a pair of over-conservative SILGen assertions.

This was our shortest practical swift crasher.



Swift SVN r31135
2015-08-11 17:41:44 +00:00
Chris Lattner
a899872d91 Reapply r31105, with some fixes to invalid unconstrained generics. These fixes correct
the regressions that r31105 introduced in the validation tests, as well as fixing a number
of other validation tests as well.

Introduce a new UnresolvedType to the type system, and have CSDiags start to use it
as a way to get more type information out of incorrect subexpressions.  UnresolvedType
generally just propagates around the type system like a type variable:
 - it magically conforms to all protocols
 - it CSGens as an unconstrained type variable.
 - it ASTPrints as _, just like a type variable.

The major difference is that UnresolvedType can be used outside the context of a
ConstraintSystem, which is useful for CSGen since it sets up several of them to 
diagnose subexpressions w.r.t. their types.

For now, our use of this is extremely limited: when a closureexpr has no contextual
type available and its parameters are invalid, we wipe them out with UnresolvedType
(instead of the previous nulltype dance) to get ambiguities later on.

We also introduce a new FreeTypeVariableBinding::UnresolvedType approach for
constraint solving (and use this only in one place in CSDiags so far, to resolve
the callee of a CallExpr) which solves a system and rewrites any leftover type 
variables as UnresolvedTypes.  This allows us to get more precise information out,
for example, diagnosing:

 func r22162441(lines: [String]) {
   lines.map { line in line.fooBar() }
 }

with: value of type 'String' has no member 'fooBar'
instead of: type of expression is ambiguous without more context

This improves a number of other diagnostics as well, but is just the infrastructural
stepping stone for greater things.





Swift SVN r31130
2015-08-11 06:06:05 +00:00
Slava Pestov
b670236701 One of the recent Sema changes fixed rdar://problem/22003613
Swift SVN r31100
2015-08-08 21:00:54 +00:00
David Farler
9aa7663ad3 Always debugPrint containers' elements
rdar://problem/19312992

Swift SVN r31067
2015-08-07 06:14:19 +00:00
Dave Abrahams
383a0564f7 Warning suppression in tests
Swift SVN r31062
2015-08-06 22:13:03 +00:00
Dmitri Hrybenko
dd3194a18c stdlib: adopt @warn_unused_result
rdar://20957486

Swift SVN r31048
2015-08-06 14:53:18 +00:00
Ben Langmuir
75b8a57952 Update SceneKit test for nullability change
Changed to nullable in new SDK.

Swift SVN r31016
2015-08-04 22:27:49 +00:00
David Farler
313a4c93c6 Review: Index protocol extensions
- Add Strict/Defaulted Index types to StdlibUnittest
- Test whether a random access index calls its more efficient
  customization by tracking successor calls.
- Fix the RandomAccessIndex.advancedBy(n, limit:) API by de-underscoring
  the limit parameter
- Inline some internal transparent default implementations to their only
  call site
- Attach _RandomAccessAmbiguity type to RandomAccessIndex

rdar://problem/22085119

Swift SVN r30979
2015-08-04 03:13:14 +00:00