Commit Graph

3633 Commits

Author SHA1 Message Date
Dmitri Hrybenko
e315581f74 StdlibUnittest tests: use a runtime trap to test expectCrashLater
This change makes the test output the same in normal runs and in ASan
builds.

Swift SVN r28507
2015-05-13 06:36:15 +00:00
Dmitri Hrybenko
843d8a4eb7 stdlib: protocol extensions: de-underscore map()
Swift SVN r28502
2015-05-13 01:58:46 +00:00
Ted Kremenek
6884540019 Revert "Re-enable validation-test/stdlib/SceneKit.swift."
This is failing on the bots.

Swift SVN r28501
2015-05-13 00:24:10 +00:00
Ted Kremenek
86dc008e5b Adjust test to new #available syntax.
Swift SVN r28497
2015-05-12 23:36:13 +00:00
Dmitri Hrybenko
c8e1ac8435 Add the GameplayKit overlay
Swift SVN r28495
2015-05-12 23:12:06 +00:00
Ted Kremenek
b564dd5e02 Re-enable validation-test/stdlib/SceneKit.swift.
Implements rdar://problem/20738811

Swift SVN r28494
2015-05-12 22:56:47 +00:00
Dmitri Hrybenko
945259f704 SDK overlay: add a smoketest for the CoreMedia overlay
Swift SVN r28493
2015-05-12 22:53:12 +00:00
Slava Pestov
8eabf84450 Sema: diagnose capturing type declarations for now
Properly implementing a class whose methods capture variables
defined in the outer scope requires adding the captures as
hidden vars in the class and initializers, and seems
non-trivial.

Just diagnose this case for now instead of crashing.

Fixes <rdar://problem/20853958>.

Swift SVN r28481
2015-05-12 18:19:37 +00:00
Dmitri Hrybenko
61214ec55b stdlib: remove Sliceable conformance from String
Swift SVN r28442
2015-05-11 20:58:31 +00:00
Slava Pestov
0ad2696d79 Don't pass -enable-guaranteed-self in tests
NFC

Swift SVN r28426
2015-05-11 18:21:35 +00:00
Chris Lattner
ddd6192094 Implement 3 prominent feature requests:
<rdar://problem/15975935> warning that you can use 'let' not 'var'
<rdar://problem/18876585> Compiler should warn me if I set a parameter as 'var' but never modify it
<rdar://problem/17224539> QoI: warn about unused variables

This uses a simple pass in MiscDiagnostics that walks the body of an
AbstractFunctionDecl.  This means that it doesn't warn about unused properties (etc),
but it captures a vast majority of the cases.

It also does not warn about unused parameters (as a policy decision) because it is too noisy,
there are a variety of other refinements that could be done as well, thoughts welcome.



Swift SVN r28412
2015-05-11 06:26:05 +00:00
Dmitri Hrybenko
0d42ed3eb2 StdlibUnittest: provide explanatory output about failing crash tests
Swift SVN r28404
2015-05-10 23:17:44 +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
2f0c1b151e Use the archetype for unqualified lookup within protocols and extensions thereof.
When performing unqualified lookup within a type context (or method
thereof) that is a protocol or a protocol extension, use the Self
archetype of the protocol or extension so we look in types implied by
the requirements as well. Part of rdar://problem/20509152, fixing the
example provided in rdar://problem/20694545.

Swift SVN r28363
2015-05-09 03:42:16 +00:00
Dmitri Hrybenko
bdd9250f12 stdlib: add tests for ${ArrayType}.init(SequenceType)
Swift SVN r28362
2015-05-09 03:32:37 +00:00
Chris Lattner
f12f1040e8 Two tests stop crashing and two start crashing due to parsing the pattern of a let decl
as an irrefutable pattern.  The crashers in the new ones are in the generics system.



Swift SVN r28349
2015-05-09 00:18:10 +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
Slava Pestov
74c2cb7820 Sema: more robust diagnostic for circular inheritance
The code would generate different diagnosics depending on
the cycle having length 1 or longer. The length 1 case
was broken if the path had a prefix that wasn't part
of the cycle, eg if we have C : A, A : A and visit C
first.

Swift SVN r28317
2015-05-08 17:14:57 +00:00
Dmitri Hrybenko
947c702ff9 Mark two compiler crashers as fixed
Swift SVN r28312
2015-05-08 02:39:32 +00:00
Dmitri Hrybenko
f46f16ae82 stdlib: implement new print() API
rdar://20775683

Swift SVN r28309
2015-05-08 01:37:59 +00:00
Ted Kremenek
9f9bb725cf Rename '_ErrorType' to 'ErrorType'.
Swift SVN r28293
2015-05-07 21:59:29 +00:00
Dmitri Hrybenko
10ab07ade5 Revert "Remove {Dictionary,Set,UnsafeMutableBufferPointer,UnsafeBufferPointer}.count"
This reverts commit r28248 while we discuss the change.

Swift SVN r28291
2015-05-07 21:45:28 +00:00
Dmitri Hrybenko
8ac6c7cf8f Remove {Dictionary,Set,UnsafeMutableBufferPointer,UnsafeBufferPointer}.count
These APIs are redundant with APIs that come from protocol extensions.

Swift SVN r28248
2015-05-07 00:30:43 +00:00
Dmitri Hrybenko
c109ec9125 stdlib: protocol extensions: de-underscore count()
Swift SVN r28246
2015-05-07 00:30:38 +00:00
Dmitri Hrybenko
e253881b02 stdlib: protocol extensions: de-underscore indices
Swift SVN r28245
2015-05-07 00:30:35 +00:00
Dmitri Hrybenko
f76ca6243e stdlib: protocol extensions: de-underscore indexOf()
Swift SVN r28244
2015-05-07 00:30:33 +00:00
Dmitri Hrybenko
25e74d21db stdlib: protocol extensions: de-underscore last
Swift SVN r28243
2015-05-07 00:30:32 +00:00
Dmitri Hrybenko
e96ade89a9 stdlib: protocol extensions: de-underscore isEmpty
Swift SVN r28241
2015-05-07 00:30:29 +00:00
Dmitri Hrybenko
275cfc0545 stdlib: protocol extensions: de-underscore underestimateCount()
Swift SVN r28240
2015-05-07 00:30:28 +00:00
Dmitri Hrybenko
97db2def53 stdlib: protocol extensions: de-underscore flatMap()
Swift SVN r28239
2015-05-07 00:30:27 +00:00
Dmitri Hrybenko
a474641f66 stdlib: protocol extensions: de-underscore reverse()
Swift SVN r28238
2015-05-07 00:30:26 +00:00
Dmitri Hrybenko
035d72d5a7 stdlib: protocol extensions: de-underscore contains()
Swift SVN r28236
2015-05-07 00:30:24 +00:00
Dmitri Hrybenko
78d1196f33 stdlib: protocol extensions: de-underscore elementsEqual
Swift SVN r28234
2015-05-07 00:30:22 +00:00
Dmitri Hrybenko
7e9063a4af stdlib: protocol extensions: de-underscore enumerate()
Swift SVN r28231
2015-05-07 00:30:12 +00:00
Joe Pamer
3b57cabae7 Consider default argument patterns, as they relate to actual arguments, when deciding on a specific overload to favor for a function application. Doing so addresses another class of exponential behavior bugs in the type checker (rdar://problem/19779591 and rdar://problem/20772053). There's still some work left to do, though - hence the change to Concatenate.swift, to work around rdar://problem/20789500.
Swift SVN r28221
2015-05-06 22:32:07 +00:00
Roman Levenstein
984fcef576 Produce an error for generic parameters of functions if those parameters are not used in function signature.
If a generic parameter is not referred to from a function signature, it can never be inferred and thus such a function can never be invoked.

We now produce the following error:

generic parameter 'T' is not used in function signature
func f8<T> (x: Int) {}

This commit takes Jordan't comments on r28181 into account:
- it produces a shorter error message
- it does not change the compiler_crashers_fixed test and add a new expected error instead

Swift SVN r28194
2015-05-06 02:20:39 +00:00
Roman Levenstein
a3a25000ff Revert "Produce an error for generic parameters of functions if those parameters are not used in function signature."
This reverts commit r28181. I'll change it according to Jordan's comments and re-commit.

Swift SVN r28193
2015-05-06 02:20:36 +00:00
Roman Levenstein
ebe3fddbe6 Produce an error for generic parameters of functions if those parameters are not used in function signature.
If a generic parameter is not referred to from a function signature, it can never be inferred and thus such a function can never be invoked.

We now produce the following error:

There is no way to infer the generic parameter 'T' if it is not used in function signature
func f8<T> (x: Int) {}
             ^

Swift SVN r28181
2015-05-05 21:02:11 +00:00
Chris Lattner
7724e92955 this test is fixed.
Swift SVN r28109
2015-05-04 04:01:45 +00:00
Chris Lattner
f3416ab719 fix a bug introduced in r28104: we need to create a PBD to hold the vardecls
we parsed, otherwise the type checker gets confused later.  This fixes these
regressions:

    Swift :: compiler_crashers_fixed/0725-swift-type-walk.swift
    Swift :: compiler_crashers_fixed/0742-swift-metatypetype-get.swift
    Swift :: compiler_crashers_fixed/1501-swift-diagnosticengine-flushactivediagnostic.swift
    Swift :: compiler_crashers_fixed/1705-vtable.swift

Also, that patch fixed 0791-swift-type-walk.swift, so mark it as not crashing.


Swift SVN r28108
2015-05-04 04:01:28 +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
Dmitri Hrybenko
b08a57f752 stdlib tests: fix coding style
Swift SVN r28071
2015-05-02 03:33:10 +00:00
John McCall
0388c87613 Fix validation tests for error-handling import.
Swift SVN r28070
2015-05-02 02:46:34 +00:00
Dave Abrahams
4ce1891cae [stdlib] String is no longer a SequenceType
<rdar://20494686>

String itsef should only expose Unicode-correct algorithms, like proper
substring/prefix/suffix search, enumerating words/lines/paragraphs, case
folding etc. Promoting sequence-centric algorithms to methods on String
is not acceptable since it invites users to write wrong code. Thus,
String has to lose its SequenceType conformance.

Nevertheless, we recognize that sometimes it is useful to manipulate the
String contents on lower levels (UTF-8, UTF-16, Unicode scalars,
extended grapheme clusters), for example, when implementing high-level
Unicode operations, so we can't remove low-level operations
altogether. For this reason, String provides nested "views" for the
first three low-level representations, but grapheme clusters were in a
privileged position -- String itself is a collection of grapheme
clusters. We propose to add a characters view that will represent the
String as a collection of Character values.

Swift SVN r28065
2015-05-02 01:52:02 +00:00
Ted Kremenek
9f5437e2bc Make 'toInt()' unavailable instead of deprecated.
Swift SVN r28029
2015-05-01 06:25:52 +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
Doug Gregor
5de47e93dd Remove uses of getProtocols() from serialization.
NFC except for having to work around the brokenness of
-enable-source-import in more places.

Swift SVN r27979
2015-04-30 16:13:45 +00:00
Doug Gregor
d0282e0d62 Switch the AST printer over to getLocalProtocols().
Swift SVN r27968
2015-04-30 16:13:37 +00:00