Commit Graph

58 Commits

Author SHA1 Message Date
Kuba (Brecka) Mracek
8b189d99e4 Turn off SWIFT_ENABLE_REFLECTION on the stdlib_minimal preset (#39030) 2021-09-12 18:54:53 -07:00
David Zarzycki
5dcc32f98f Remove all uses of -force-single-frontend-invocation
The `-force-single-frontend-invocation` flag predates WMO and is now an
alias for `-whole-module-optimization`. We should use the latter and let
the former fade into history.
2020-05-08 06:37:41 -04:00
Arnold Schwaighofer
2d8a1dbbfe Codesign test/stdlib 2018-08-10 06:58:40 -07:00
Joe Shajrawi
66d0df6bae Revert "Temporary disable failing armv7 tests"
This reverts commit 78e5e25215.
2017-08-15 13:43:57 -07:00
Joe Shajrawi
78e5e25215 Temporary disable failing armv7 tests 2017-08-08 15:22:14 -07:00
Dmitri Gribenko
486cab447d tests: replace 'rm -rf %t && mkdir -p %t' with '%empty-directory(%t)'
These changes were made using a script.
2017-06-04 11:08:39 -07:00
Dmitri Gribenko
55864d10cb Tests: use 'mkdir -p' 2016-09-02 21:36:45 -07:00
Max Moiseev
9fc37efee4 [test] renaming test/1_stdlib to just test/stdlib 2016-09-01 16:51:43 -07:00
Jordan Rose
e83c117c30 [test] Hack: run stdlib tests first to start long-running tests earlier.
This decreases total testing time by over a minute on my old Mac Pro.
It probably has much less effect on systems with fewer cores, but shouldn't
be any worse there.

Swift SVN r22745
2014-10-15 01:30:51 +00:00
Erik Eckstein
d0697f2ac1 Make internal stdlib functions public, which are called from the stdlib tests.
And make sure that all those public identifiers are preceeded with underscores.

I marked these public-modifiers with "// @testable" to document why they are public.
If some day we have a @testable attribute it should be used instead of those public-modifiers.

Again, this is needed for enabling dead internal function elimination in the stdlib.



Swift SVN r22657
2014-10-10 09:45:10 +00:00
Dmitri Hrybenko
1e7f0f8b39 Add tests for printing metatypes
Swift SVN r22260
2014-09-24 10:05:43 +00:00
Doug Gregor
df33350219 Switch string interpolation protocol over to initializer requirements.
With this, we're now using initializer requirements rather than
"convertFromXXX" requirements everywhere, addressing the rest of
rdar://problem/18154091. r22176 eliminated the performance penalty
that prevented this change from sticking earlier.



Swift SVN r22177
2014-09-22 20:17:55 +00:00
Doug Gregor
82d7daf5fc Revert StringInterpolationConvertible back to class method requirements.
The initializer requirement is causing too much exponential behavior
in the constraint solver. We'll have to address that
first. Re-instating this change is tracked by rdar://problem/18381811.


Swift SVN r22080
2014-09-18 17:10:53 +00:00
Doug Gregor
f1e47a7b18 Switch string interpolation protocol over to initializer requirements.
With this, we're now using initializer requirements rather than
"convertFromXXX" requirements everywhere, addressing the rest of
rdar://problem/18154091.


Swift SVN r22078
2014-09-18 16:13:18 +00:00
Doug Gregor
3ebf5cb3da Switch the string literal protocols over to initializer requirements.
Swift SVN r22076
2014-09-18 15:48:42 +00:00
Dmitri Hrybenko
44bf1a81a6 stdlib/Printing: print floating point numbers with appropriate precesion for
the type

Printing Float32 with %0.15g not only wastes screen space, but also causes
confusion for users, and pretends that a Float32 has more precision than it
actually does.

rdar://18043123


Swift SVN r21435
2014-08-25 13:56:38 +00:00
Dmitri Hrybenko
a7f886a7a4 stdlib/Printing: add a regression test for rdar://17222588, this works
correctly now


Swift SVN r21235
2014-08-15 16:40:15 +00:00
Dmitri Hrybenko
938e7c2676 stdlib: introduce UnicodeScalarLiteralConvertible protocol
This allows UnicodeScalars to be constructed from an integer, rather
then from a string.  Not only this avoids an unnecessary memory
allocation (!) when creating a UnicodeScalar, this also allows the
compiler to statically check that the string contains a single scalar
value (in the same way the compiler checks that Character contains only
a single extended grapheme cluster).

rdar://17966622

Swift SVN r21198
2014-08-14 16:04:39 +00:00
Dmitri Hrybenko
1fc7709085 Fix Dictionary printing test on 32-bit platforms by allowing any
key/value order

Swift SVN r21149
2014-08-12 16:49:04 +00:00
Dmitri Hrybenko
3b3516216a Fix 80-cols violation
Swift SVN r20984
2014-08-03 22:51:08 +00:00
Dave Abrahams
db1bbdaacf One more missing bitPattern:
Swift SVN r20982
2014-08-03 22:42:13 +00:00
Dave Abrahams
10ee277fd0 Add a few missing bitPattern:'s
Swift SVN r20981
2014-08-03 22:38:56 +00:00
Dmitri Hrybenko
2688dd426f stdlib/Print test: simplify code
Swift SVN r20954
2014-08-02 17:11:50 +00:00
Dmitri Hrybenko
9c8d30ea11 stdlib/Reflection: fix over-release that I introduced in r20671 trying to fix a
leak.  The release was valid only for some code paths.

Added some comments explaining ownership and parameter passing conventions.

Fixes rdar://17855302, restores half of the leak in rdar://17840810 (only for
objects that inherit from NSObject).


Swift SVN r20820
2014-07-31 11:49:43 +00:00
Greg Parker
4a33110d9c [test] Disable tuple printing test pending rdar://17855302.
Swift SVN r20754
2014-07-30 12:39:04 +00:00
Dave Abrahams
31d6f95452 [stdlib] UnsafeBufferPointer: add ".count"
In answering a forum post I noiced that I wanted this and it was
missing.

Also, extensive comments

Also, rename the length: init parameter to count:.  When writing the
comments for the init function it became painfully clear why we use
"count" is better than "length" especially around pointers and memory:
the former is much less easy to mistake for "length in bytes".  Plus
it's consistent with the new ".count" property

Swift SVN r20609
2014-07-28 01:03:09 +00:00
Dmitri Hrybenko
706934b98f stdlib/Printing: fold a small test into the existing one
Swift SVN r20528
2014-07-25 00:14:17 +00:00
Dmitri Hrybenko
27cbb5a9d5 stdlib/String: change == to perform string comparison after NFD
normalization

There is still some obscure bug with != on NSString, probably caused by
an ill-thought overload somewhere.

Part of rdar://17498444

Swift SVN r20518
2014-07-24 21:36:01 +00:00
Dave Abrahams
d00e888d95 [stdlib] Rename reinterpretCast => unsafeBitCast
Also give unsafeBitCast an explicit type parameter.  So

  let x: T = reinterpretCast(y)

becomes

  let x = unsafeBitCast(y, T.self)

Swift SVN r20487
2014-07-24 13:17:36 +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
Dave Abrahams
e3f8d0e630 [stdlib] rename UnsafeArray => UnsafeBufferPointer
Also,

  UnsafeMutableArray => UnsafeMutableBufferPointer
  withUnsafeMutableStorage => withUnsafeMutableBufferPointer

Swift SVN r20340
2014-07-22 22:20:37 +00:00
Dmitri Hrybenko
1c2cd46094 stdlib/Printing: fix pointer printing on 32-bit platforms
Swift SVN r20325
2014-07-22 19:03:04 +00:00
Dave Abrahams
03dca56669 Add merges missed in r20316
Swift SVN r20317
2014-07-22 17:02:12 +00:00
Dmitri Hrybenko
80748a5883 stdlib/Printing: add DebugPrintable conformances to unsafe pointer types
rdar://16896025 rdar://16896013

Swift SVN r20312
2014-07-22 16:06:47 +00:00
Dmitri Hrybenko
d125ac1e24 stdlib/runtime: stdlib casts to existentials: correctly project the buffer as
required

rdar://17628745


Swift SVN r20024
2014-07-16 15:17:46 +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
Joe Groff
c34b4f6a9e Enable string-to-pointer conversions and remove CString.
There is some follow-up work remaining:

- test/stdlib/UnicodeTrie test kills the type checker without manual type annotations. <rdar://problem/17539704>
- test/Sema/availability test raises a type error on 'a: String == nil', which we want, but probably not as a side effect of string-to-pointer conversions. I'll fix this next.

Swift SVN r19477
2014-07-02 19:15:10 +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
Dmitri Hrybenko
68c7a45c9b stdlib/printing: change Optional<T> representation in print to be Optional(...)
Because we are adding text to show internal representation, change the
conformance from Printable to DebugPrintable.

rdar://16950055


Swift SVN r19341
2014-06-30 15:23:51 +00:00
Doug Gregor
e064416c8f Update the rest of the testsuite for the array syntax change.
Swift SVN r19223
2014-06-26 05:39:25 +00:00
Dmitri Hrybenko
f370ca0746 stdlib: fix a bunch of various Unicode issues, primarily in UTF-8 decoding
In UTF-8 decoder:
- implement U+FFFD insertion according to the recommendation given in the
  Unicode spec.  This required changing the decoder to become stateful, which
  significantly increased complexity due to the need to maintain an internal
  buffer.
- reject invalid code unit sequences properly instead of crashing rdar://16767868
- reject overlong sequences rdar://16767911

In stdlib:
- change APIs that assume that UTF decoding can never fail to account for
  possibility of errors
- fix a bug in UnicodeScalarView that could cause a crash during backward
  iteration if U+8000 is present in the string
- allow noncharacters in UnicodeScalar.  They are explicitly allowed in the
  definition of "Unicode scalar" in the specification.  Disallowing noncharacters
  in UnicodeScalar prevents actually using these scalar values as internal
  special values during string processing, which is exactly the reason why they
  are reserved in the first place.
- fix a crash in String.fromCString() that could happen if it was passed a null
  pointer

In Lexer:
- allow noncharacters in string literals.  These Unicode scalar values are not
  allowed to be exchanged externally, but it is totally reasonable to have them
  in literals as long as they don't escape the program.  For example, using
  U+FFFF as a delimiter and then calling str.split("\uffff") is completely
  reasonable.

This is a lot of changes in a single commit; the primary reason why they are
lumped together is the need to change stdlib APIs to account for the
possibility of UTF decoding failure, and this has long-reaching effects
throughout stdlib where these APIs are used.


Swift SVN r19045
2014-06-20 13:07:40 +00:00
Dmitri Hrybenko
ce14332bb6 stdlib: make UnicodeScalar.escape() independent of current locale
Swift SVN r18595
2014-05-23 15:40:47 +00:00
Joe Groff
464bce4b39 IRGen: Put witness tables into no_dead_strip sections.
Witness tables can't be dead-stripped without breaking the dynamic conformance queries printing now relies on. Fixes <rdar://problem/16993349>.

Swift SVN r18567
2014-05-22 19:30:45 +00:00
Greg Parker
f24baa1eb7 [test] Create temp directory before using it.
Swift SVN r18497
2014-05-21 18:08:10 +00:00
Dmitri Hrybenko
5855c2b34f stdlib/Printing: remove superfluous newlocale() call
Also add tests for post-processing printed results in scientific notation.


Swift SVN r18495
2014-05-21 14:12:31 +00:00
Dmitri Hrybenko
a80603f3bb stdlib/Floating point: switch infinity, NaN, quietNaN to properties
Swift SVN r18348
2014-05-18 20:30:57 +00:00
Ted Kremenek
d83b68bea5 Rename class method 'infinite()' to 'infinity()'.
Swift SVN r18311
2014-05-18 04:49:03 +00:00
Ted Kremenek
e5aa1a8edb Change func 'inf()' to 'infinite()' to match 'isInfinite'.
Swift SVN r18309
2014-05-18 04:24:41 +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
Greg Parker
81c4e7392d [test] Fix Int size dependence in stdlib/Print.swift.
Swift SVN r18224
2014-05-16 23:06:24 +00:00