Commit Graph

805 Commits

Author SHA1 Message Date
Maxim Moiseev
c678a839dc IndexType => Index 2015-12-09 17:16:42 -08:00
Dmitri Gribenko
5a07f89297 Remove 'generator' from names of test functions and local variables 2015-12-09 17:15:11 -08:00
Maxim Moiseev
7e2466c14e CollectionType => Collection 2015-12-09 17:12:48 -08:00
Dmitri Gribenko
99d3f96c6d Rename IndexingGenerator to CollectionDefaultIterator 2015-12-09 17:12:07 -08:00
Dmitri Gribenko
1c0047829a Rename SequenceType.generate() to SequenceType.iterator() 2015-12-09 17:11:17 -08:00
Dmitri Gribenko
2cf172160c Rename SequenceType.Generator associated type to SequenceType.Iterator 2015-12-09 17:11:05 -08:00
Dmitri Gribenko
31598d41bf Rename GeneratorType to IteratorProtocol 2015-12-07 17:08:32 -08:00
Jacob Bandes-Storch
56e13fccfd Fix crash when considering invalid binary operator function for resolution <rdar://23719809&23720006>
This fixes compiler crashes resulting from an invalid FuncDecl which is later considered while resolving a binary application.
2015-12-04 14:43:12 -08:00
David Farler
8f2fbdc93a Make function parameters and refutable patterns always immutable
All refutable patterns and function parameters marked with 'var'
is now an error.

- Using explicit 'let' keyword on function parameters causes a warning.
- Don't suggest making function parameters mutable
- Remove uses in the standard library
- Update tests

rdar://problem/23378003
2015-11-09 16:56:13 -08:00
David Farler
4ac9c80809 Add back remaining files for building and testing in Open Source 2015-10-31 00:19:20 -07: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
Slava Pestov
29409b45d6 Add testcase for a bug that seems to be fixed
Swift SVN r30774
2015-07-29 18:23:21 +00:00
Slava Pestov
f97f331b6a We shouldn't be using -verify in compiler_crashers
Swift SVN r30773
2015-07-29 18:23:19 +00:00
Slava Pestov
f435510474 Add testcase for a bug that seems to be fixed
Swift SVN r30759
2015-07-29 07:17:21 +00:00
Slava Pestov
65b317fa36 Sema: Fix infinite recursion when checking if class with circular inheritance has failable initializer
Fixes <rdar://problem/19919421>.

Swift SVN r30677
2015-07-27 00:40:45 +00:00
Dmitri Hrybenko
f5de8757e4 stdlib: remove Word and UWord
These types are leftovers from the early pre-1.0 times when Int and UInt
were always 64-bit on all platforms.  They serve no useful purpose
today.  Int and UInt are defined to be word-sized and should be used
instead.

rdar://18693488

Swift SVN r30564
2015-07-24 05:01:32 +00:00
John McCall
0ea7b2fba9 Fix some validation-test regressions, mostly by tweaking tests
but also by being a little more defensive during recovery.

Swift SVN r30424
2015-07-21 00:32:26 +00:00
Slava Pestov
6b7647c0a7 Sema: Don't set type of AssociatedTypeDecl until we have an archetype
Otherwise the verifier can crash because hasType() returns true but
getType() gives us a MetatypeType that hits a null pointer in
desugaring.

The computeType() calls appear in a few too many places for my liking;
would be nice to clean this up further or replace everything with
interface types one day.

Fixes <rdar://problem/19606899>.

Swift SVN r30388
2015-07-19 20:57:18 +00:00
Slava Pestov
e748908990 Sema: Don't set type of TypeAliasDecl until we resolve the alias type
This changes the behavior to match NominalTypeDecls, which don't have a type
until everything is set up either. In a few places we construct TypeAliasDecls
from known types directly, and we have to call computeType().

Fixes <rdar://problem/19534837>.

Swift SVN r30386
2015-07-19 20:55:53 +00:00
Slava Pestov
4e26069c8f Parse: Fix EndLoc of #if without #endif in parseDeclIfConfig(), and clean up duplication
Fixes <rdar://problem/19671208>.

Swift SVN r30314
2015-07-17 08:31:21 +00:00
Slava Pestov
c1b3569192 Parse: Fix crash with invalid protocol compositions, and improve error recovery
Fixes <rdar://problem/19686707>.

Swift SVN r30304
2015-07-17 05:57:22 +00:00
Doug Gregor
bb19420ab5 Add no-longer-recursing test from rdar://problem/21514140.
Swift SVN r30199
2015-07-14 21:18:59 +00:00
Doug Gregor
c52f920ad4 Fix an over-eager assertion.
Fixes rdar://problem/21382194; the deeper issue with this test case
was fixed recently, and only this assertion remained.

Swift SVN r30196
2015-07-14 21:17:07 +00:00
Chris Lattner
5b043a2e0a Fix <rdar://problem/21783334> compiler crashes on "{ x in x = 42"
which was the regression I introduced that broke "1616" out of the validation test.



Swift SVN r30123
2015-07-11 23:05:04 +00:00
Dave Abrahams
9d07acd368 [stdlib] SequenceType's _initializeTo should return the end position
Otherwise, the length of the sequence is in principle lost.  If you know
you have a sequence of less than 100 elements, you still want to know
exactly how many elements you initialized from it.

Swift SVN r30104
2015-07-11 01:43:27 +00:00
Dave Abrahams
ef198daa2b [stdlibunittest] Finish threading new trace facility through
Swift SVN r29955
2015-07-08 02:52:27 +00:00
Slava Pestov
bb064da539 Sema: Fix AttributeChecker crash if getDeclaredTypeInContext() returns an ErrorType
Fixes <rdar://problem/21551616>.

Swift SVN r29943
2015-07-07 21:12:16 +00:00
Dave Abrahams
70ee2adc84 [stdlibunittest] More de-boilerplating WIP
Step 2.

Swift SVN r29936
2015-07-07 04:54:03 +00:00
Chris Lattner
8637bb4c01 fix <rdar://problem/21679169> compiler crashes on "{(=_=_)in"
Swift SVN r29914
2015-07-06 04:46:56 +00:00
Doug Gregor
880ad409db Pick the potential archetype we use for the actual archetype more intelligently.
Archetypes either need to be a root, which corresponds to a type
parameter, or need to be parented by another archetype. When the
representative of an equivalence class of potential archetypes has a
parent, but that parent has been made equivalent to some concrete type
via a same-type constraint, choose a different potential archetype as
the "anchor", i.e., one that has no concrete types in its parent
chain. Fixes rdar://problem/21625478 and the canonical example in
rdar://problem/17619740.

Swift SVN r29898
2015-07-02 20:57:37 +00:00
Doug Gregor
9f66a12a9c Add test from rdar://problem/21333511 that no longer crashes.
Swift SVN r29883
2015-07-02 04:53:10 +00:00
Doug Gregor
87b4eeccf3 Make same-type requirements prefer to be rooted at outer generic parameters.
All archetypes from outer scopes are fixed (as a lame implementation
restriction), so same-type constraints that involve archetypes from
outer scopres should treat the archetypes from outer scopes as the
representative. Do so, and start eliminating the notion of a "primary"
archetype that was preventing this fix from occurring earlier, so that
"all archetypes" and the set of requirements generated from the
archetype builder still line up.

Fixes rdar://problem/19519590.

Swift SVN r29869
2015-07-02 00:08:24 +00:00
Doug Gregor
a8b7ff86cd Add test case for rdar://problem/21598514.
Swift SVN r29811
2015-06-30 21:51:09 +00:00
Doug Gregor
7ee8b36993 Be more defensive when looking up associated types.
The attempted invariants were too strong for ill-formed code. Fixes
rdar://problem/21511651.

Swift SVN r29801
2015-06-30 05:14:04 +00:00
Doug Gregor
025c35d541 Don't invalide Substitution invariants in ill-formed code.
Fixes the crasher in rdar://problem/21524144.

Swift SVN r29741
2015-06-26 17:12:07 +00:00
Doug Gregor
22c2585ac9 Add now-fixed test case from rdar://problem/21087186.
Swift SVN r29670
2015-06-25 16:39:06 +00:00
Slava Pestov
d919b45937 SILGen: DiverseStack defines stable iterators; let's use them
DeferCleanup pushes a new temporary cleanup to catch non-local returns
from the defer block, so we have to use stable iterators while emitting
cleanups.

There's no good deterministic test case for this -- it would manifest
as memory corruption if the underlying storage of the DiverseStack
grew beyond the inline storage. Add a reduced version of the original
user-reported test case that triggers it reliably -- I had a hard time
coming up with anything simpler.

Fixes <rdar://problem/21437203>.

Swift SVN r29658
2015-06-25 05:00:50 +00:00
Slava Pestov
7b2aa2c0a2 SILGen: Fix lvalue reabstraction
We didn't have any tests exercising SubstToOrigComponent and in
fact it was broken. Fix emitInOut() to remove a level of inout
from the origParam abstraction pattern and add some tests.

Fixes <rdar://problem/20985062>.

Swift SVN r29644
2015-06-24 22:27:54 +00:00
Slava Pestov
665b870f7f Sema: Fix yet another crash when accessing nested types of an existential
We diagnose usage of invalid existential types but we might still
try to compute substitutions. Just whip up an ErrorType instead.

Fixes <rdar://problem/16803384>.

Swift SVN r29567
2015-06-23 06:39:22 +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
Doug Gregor
bb35361b5b Add test for rdar://problem/20508671.
Swift SVN r29120
2015-05-28 23:24:26 +00:00
Doug Gregor
6a0382caf1 Add test from rdar://problem/20270240.
Swift SVN r29110
2015-05-28 20:20:11 +00:00
Doug Gregor
a6300dfdc5 "Properly" compute the depth of Self in ill-formed protocol declarations.
Rather than always using depth 0 for the Self generic type parameter
of a protocol, which is the correct value in well-formed code,
actually compute the depth based on the context. This maintains the
depth invariants of the AST in ill-formed code, resolving a large
number of crashers (169), including rdar://problem/21042357, and
regresses one crasher.

Swift SVN r28920
2015-05-22 16:28:29 +00:00
Joe Groff
1af4659c4a Enable interface type mangling.
Fixes rdar://problem/18034517, and addresses a number of compiler crashers due to symbol collisions in the old mangling.

Swift SVN r28383
2015-05-09 22:20:57 +00:00
Doug Gregor
0749486302 Let unqualified lookup find members of protocols and extensions thereof.
Members of protocols found via unqualified name lookup are mapped to
their corresponding witnesses, as we do for qualified name
lookup. This is the bulk of the compiler changes for
rdar://problem/20509152. Performing this mapping for unqualified name
lookup of types will follow.

Swift SVN r28333
2015-05-08 23:22:13 +00:00
Dmitri Hrybenko
e5e4b38808 Eliminate a use of println() where it is irrelevant
Swift SVN r28093
2015-05-03 04:09:34 +00:00
Slava Pestov
1c64eee1c4 Add testcase for <rdar://18996669> which seems to be fixed already
Swift SVN r28091
2015-05-02 19:31:29 +00:00
Doug Gregor
e4f2cef6f7 Eliminate archetypes from interface types.
The culprit happened to be a type representation cloner for tuple type
representations that didn't actually clone anything. Introduce an
AST-level verifier that makes sure we catch any archetypes that slip
into interface types earlier in the future.

Fixes rdar://problem/18796397 and the three dupes I've found so far.

Swift SVN r28080
2015-05-02 05:28:57 +00:00
Doug Gregor
fbbd834493 Add test case from rdar://problem/20750480, which no longer crashes.
Swift SVN r28027
2015-05-01 05:59:31 +00:00
Chris Lattner
31c01eab73 Change the meaning of "if let x = foo()" back to Xcode 6.4 semantics. The compiler
includes a number of QoI things to help people write the correct code.  I will commit
the testcase for it as the next patch.

The bulk of this patch is moving the stdlib, testsuite and validation testsuite to
the new syntax.  I moved a few uses of "as" patterns back to as? expressions in the 
stdlib as well.



Swift SVN r27959
2015-04-30 04:38:13 +00:00