Commit Graph

33 Commits

Author SHA1 Message Date
Dmitri Gribenko
65d840c0ae stdlib: lowercase cases in Optional and ImplicitlyUnwrappedOptional 2016-02-18 00:40:33 -08:00
Joe Pamer
828eb68e72 Commit DaveA's API changes to 'print', along with the compiler changes necessary to support them.
There's still work left to do. In terms of next steps, there's still rdar://problem/22126141, which covers removing the 'workaround' overloads for print (that prevent bogus overload resolution failures), as well as providing a decent diagnostic when users invoke print with 'appendNewline'.

Swift SVN r30976
2015-08-04 01:57:11 +00:00
Chris Lattner
56c1f9d13b preserve type sugar more aggressively on result types of constructor calls whose
metatype carries sugar and calls to functions whose functiontype carries sugar.


Swift SVN r30582
2015-07-24 18:19:09 +00:00
Doug Gregor
3926c349b2 Eliminate uses of ‘#’ from the testsuite.
Swift SVN r28842
2015-05-20 20:21:42 +00:00
Dmitri Hrybenko
f46f16ae82 stdlib: implement new print() API
rdar://20775683

Swift SVN r28309
2015-05-08 01:37:59 +00:00
Chris Lattner
8494651d22 Substantially rework CSApply's building of argument lists for calls.
This fixes <rdar://problem/20494437> SILGen crash handling default arguments
again, and includes a fix for MiscDiagnostics to look through the generated
TupleShuffleExprs in @noescape processing (which tripped up XCTest).

This fixes <rdar://problem/16860940> QoI: Strict keyword arguments loses type sugar in calls
where we'd lose some type sugar.

This fixes sanity in the ASTs: ScalarToTupleExpr now always has consistent
types between its argument and result, so we can turn on AST Verification of it.




Swift SVN r27827
2015-04-27 23:02:09 +00:00
Dave Abrahams
ac3f047496 [stdlib] Renaming fallout from Mirror API review
toString(x)      => String(x)
toDebugString(x) => String(reflecting: x)
Printable        => CustomStringConvertible
DebugPrintable   => CustomDebugStringConvertible

Also updated comments to clarify these protocols

Swift SVN r27090
2015-04-07 20:32:26 +00:00
Doug Gregor
d3b783d4bc Re-enable REPL test for conformances added after they are checked.
I broke this in the early stages of the conformance lookup table, and
it's unbroken now. rdar://problem/20163191.

Swift SVN r26524
2015-03-25 05:23:10 +00:00
Doug Gregor
f7dacd096b Don't force implied protocol conformances into the current DeclContext.
When we check a protocol conformance, we recurse to check the implied
protocol conformances for inherited protocols first. When doing so, we
were passing down the current DeclContext, which would force the
creation of a new conformance to that protocol within that
DeclContext. This isn't what we want: we want to find or create the
conformance in whichever context it naturally belongs.

This is a partial step toward solving the problem, which eliminates
the duplicate witness tables from the example in
rdar://problem/18182969. However, we're still not using the
conformance lookup table to decide where the witness tables/protocol
conformances go, which means the actual declaration context for a
witness table is still a bit ad hoc.

Baby steps.

Swift SVN r26129
2015-03-14 06:18:19 +00:00
Chris Willmore
42dba24464 Don't allow '{' at start of if-condition
If '{' is encountered immediately after 'if', assume that the condition
is missing. Apply the same treatment to while, do-while, for-in, and
switch. This way we're not trying to re-parse, backtrack, repurpose
misparsed closure bodies, etc. in those cases. Users who want to write a
condition that starts with '{' can wrap it in parens.

Addressing feedback re <rdar://problem/18940198>.

Swift SVN r25747
2015-03-04 05:39:49 +00:00
Chris Willmore
340106f97c Remove XFAIL after fixing 19919467.
Swift SVN r25497
2015-02-24 03:24:19 +00:00
Dmitri Hrybenko
10d8533e4b XFAIL the new regressions under AddressSanitizer
<rdar://problem/19919467> Interpreter/repl.swift regressed under ASan
<rdar://problem/19919459>
compiler_crashers/0214-swift-typebase-gettypeofmember.swift regressed
under ASan

Swift SVN r25483
2015-02-23 10:34:31 +00:00
Dmitri Hrybenko
6058d291ca CMake: allow the SDK overlay to be built separately from the compiler
and the stdandard library

rdar://19703353

Swift SVN r25139
2015-02-10 21:57:03 +00:00
Joe Groff
ad78204c50 Parser: Explicitly ban closures at the beginning of statements.
This already can't happen in most circumstances because of trailing closures, but we didn't explicitly disallow it at the beginning of a BraceStmt or following a statement production. Fixes the parser part of rdar://problem/17850752 (though there's a type checker bug there too).

Swift SVN r21663
2014-09-03 00:37:55 +00:00
Dmitri Hrybenko
3a04e0809f stdlib: add a function to squeeze a number in a given range from a hash value
This function mixes the bits in the hash value, which improves Dictionary
performance for keys with bad hashes.

PrecommitBenchmark changes with greater than 7% difference:

``````````Dictionary2`,```1456.00`,```1508.00`,```1502.00`,````624.00`,````607.00`,````592.00`,`864.00`,``145.9%
``````````Dictionary3`,```1379.00`,```1439.00`,```1408.00`,````585.00`,````567.00`,````552.00`,`827.00`,``149.8%
````````````Histogram`,````850.00`,````849.00`,````851.00`,```1053.00`,```1049.00`,```1048.00`,`199.00`,``-19.0%
````````````````Prims`,```1999.00`,```2005.00`,```2018.00`,```1734.00`,```1689.00`,```1701.00`,`310.00`,```18.4%
``````````StrSplitter`,```2365.00`,```2334.00`,```2316.00`,```1979.00`,```1997.00`,```2000.00`,`337.00`,```17.0%
```````````````TwoSum`,```1551.00`,```1568.00`,```1556.00`,```1771.00`,```1741.00`,```1716.00`,`165.00`,```-9.6%

Regressions are in benchmarks that use `Int` as dictionary key: we are just
doing more work than previously (hashing an `Int` was an identity function).

rdar://17962402


Swift SVN r21142
2014-08-12 12:02:26 +00:00
Dmitri Hrybenko
09561ae6fa stdlib/Printing: when printing objects without Printable conformances, print
demangled names

rdar://16929868


Swift SVN r20386
2014-07-23 11:01:51 +00:00
Enrico Granata
3dfff3a34d Fix tests that were broken by my last changes.
Swift SVN r19818
2014-07-10 19:15:38 +00:00
Doug Gregor
2f3f6acf21 Make "true" and "false" Boolean literal constants for the BooleanLiteralConvertible protocol.
Introduce the new BooleanLiteralConvertible protocol for Boolean
literals. Take "true" and "false" as real keywords (which is most of the
reason for the testsuite churn). Make Bool BooleanLiteralConvertible
and the default Boolean literal type, and ObjCBool
BooleanLiteralConvertible. Fixes <rdar://problem/17405310> and the
recent regression that made ObjCBool not work with true/false.


Swift SVN r19728
2014-07-09 16:57:35 +00:00
Jordan Rose
f0fc440785 One last cleanup for access control.
Swift SVN r19662
2014-07-08 00:59:07 +00:00
Chris Lattner
287059b360 implement <rdar://problem/17279286> Swift has too many Unicode escape sequence forms
This consolidates the \x, \u, and \U escape sequences into one \u{abc} escape sequence.
For now we still parse and cleanly reject the old forms with a nice error message, this
will eventually be removed in a later beta (tracked by rdar://17527814)


Swift SVN r19435
2014-07-01 23:27:44 +00:00
Doug Gregor
39bcf3bd85 Re-sugar the types we deduce for type variables.
This makes us deduce types like "[Int]" and "[String : Int]" from
array/dictionary literals, giving a nicer REPL experience.


Swift SVN r19258
2014-06-26 22:04:47 +00:00
Doug Gregor
55df89aabe Print array types as [T] instead of T[].
Swift SVN r19195
2014-06-25 23:59:51 +00:00
Doug Gregor
9210cd5ff4 Replace T[] array syntax with [T] in the test suite
Swift SVN r19192
2014-06-25 23:39:24 +00:00
Chris Lattner
70076cf958 switch the testsuite to use the ..< operator instead of ..
Swift SVN r19003
2014-06-19 17:18:23 +00:00
Dmitri Hrybenko
6808737952 stdlib/CString printing: fix a null dereference in writeTo, similar to one that
was fixed in debugDescription


Swift SVN r18258
2014-05-17 17:15:52 +00:00
Ted Kremenek
fc47f11a29 Fix crash in CString's 'debugDescription' when the underlying pointer is null.
Fixes <rdar://problem/16227050>

Swift SVN r18202
2014-05-16 18:03:51 +00:00
Ted Kremenek
178e2a32df Printing routines should append ".0" to floats, *not* taking locales into account.
Implements <rdar://problem/16895801>.

Swift SVN r18185
2014-05-16 07:27:54 +00:00
Ted Kremenek
9eea282719 Switch range operators ".." and "...".
- 1..3 now means 1,2
- 1...3 now means 1,2,3

Implements <rdar://problem/16839891>

Swift SVN r18066
2014-05-14 07:36:00 +00:00
Dmitri Hrybenko
de9a0c8ff0 stdlib/printing: remove ReplPrintable protocol
It is replaced by debugPrint() family of functions, that are called by REPL.

There is a regression in printing types that don't conform to Printable, this
is tracked by rdar://16898708


Swift SVN r18006
2014-05-13 16:22:56 +00:00
Dmitri Hrybenko
2cc8fe40d4 stdlib/printing: replace four printing systems with one new one
The old ones were:

- print/println
- printAny
- printf
- Console

The new printing story is just print/println.  Every object can be printed.
You can customize the way it is printed by adopting Printable protocol.  Full
details in comments inside stdlib/core/OutputStream.swift.

Printing is not completely finished yet.  We still have ReplPrintable, which
should be removed, string interpolation still uses String constructors, and
printing objects that don't conform to Printable will result in printing
mangled names.


Swift SVN r18001
2014-05-13 13:07:59 +00:00
Doug Gregor
1efd9fba5b Start accepting '#' in addition to '`' to mark a keyword argument <rdar://problem/16891828>.
Update the standard library, tests, diagnostics, and Fix-Its.

Swift SVN r17981
2014-05-13 00:03:04 +00:00
Ted Kremenek
fad874708e Adjust test cases.
Swift SVN r17964
2014-05-12 22:01:52 +00:00
Eli Friedman
a5e1b4c645 Fix the REPL, which I accidentally broke. Add a test so it doesn't break by accident again.
Swift SVN r1504
2012-04-19 21:30:23 +00:00