Commit Graph

3245 Commits

Author SHA1 Message Date
Dmitri Hrybenko
bc144c313e NSString test: disable the problematic test on iOS simulator and iOS 7.*
Swift SVN r21043
2014-08-05 21:24:51 +00:00
Dmitri Hrybenko
dc6df9307e Attempt to fix a test for NSString API on String when run on OS X 10.9
Swift SVN r21041
2014-08-05 15:05:13 +00:00
Dmitri Hrybenko
b09698a6e6 stdlib: privatize lazyConcatenate() and related APIs
Swift SVN r21039
2014-08-05 14:55:09 +00:00
Enrico Granata
61a3851e58 Attempt to fix the Reflection test case failure
Swift SVN r21025
2014-08-04 22:17:11 +00:00
Enrico Granata
a472b40551 Add Mirror conformances for StrideTo and StrideThrough. These are mostly there to embellish the labels for child elements, as the default struct Mirror is doing a good enough job on its own. Fixes rdar://17876067
Swift SVN r21023
2014-08-04 19:07:33 +00:00
Dmitri Hrybenko
8c41e1892b stdlib/NSString APIs on String: change stringByRemovingPercentEncoding property
type to be an optional string; add tests


Swift SVN r21021
2014-08-04 18:02:14 +00:00
Dmitri Hrybenko
0e7e26328c stdlib/NSString APIs on String: add more tests
Swift SVN r21019
2014-08-04 17:01:57 +00:00
Dmitri Hrybenko
67de904c15 stdlib/NSString APIs on String: change stringByAppendingPathExtension() to
return an optional String.  This behavior is not documeted, though.


Swift SVN r21016
2014-08-04 16:41:37 +00:00
Dmitri Hrybenko
a75c7a427a stdlib/NSString APIs on String: add more tests and fix a crash in
_countFormatSpecifiers() that was triggered by non-BMP characters in the format
string


Swift SVN r21014
2014-08-04 15:37:58 +00:00
Dmitri Hrybenko
adab0726ff stdlib/NSString APIs on String: add tests for substringWithRange()
Swift SVN r21009
2014-08-04 14:49:07 +00:00
Dmitri Hrybenko
edc664c36f stdlib/NSString APIs on String: change return type of
stringByAddingPercentEncodingWithAllowedCharacters() and
stringByAddingPercentEscapesUsingEncoding() to String?, and add API notes for
NSString to the same effect


Swift SVN r21007
2014-08-04 14:13:46 +00:00
Dmitri Hrybenko
6e3a9e93e7 NewStringAppending: attempt to fix this test under ASan by making it
independent of memory allocator implementation


Swift SVN r21005
2014-08-04 11:03:37 +00:00
Dave Abrahams
e70c19f021 [stdlib] Don't allow String() + Character("x")
Symmetry with what we did for Arrays says that Strings shoudl only
concatenate to Strings using "+".  We have append() for adding single
characters.

Swift SVN r20997
2014-08-04 06:44:34 +00:00
Dave Abrahams
70b388ba77 [stdlib] Add append() to ExtensibleCollectionType
If you can be grown by an arbitrary sequence of your element type, you
can be grown by a single element.

Swift SVN r20996
2014-08-04 06:44:33 +00:00
Dave Abrahams
1ec2b36fc1 [stdlib] Implement String.reserveCapacity
Fixes <rdar://problem/16970908>

Swift SVN r20989
2014-08-03 23:55:57 +00:00
Dmitri Hrybenko
3b3516216a Fix 80-cols violation
Swift SVN r20984
2014-08-03 22:51:08 +00:00
Dave Abrahams
9fc959b862 [stdlib] UnicodeScalarView : RangeReplaceableCollectionType
Fixes <rdar://problem/17860946> Full Array mutation APIs for String and UnicodeScalarView

Swift SVN r20983
2014-08-03 22:44:03 +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
Dave Abrahams
0c5cbd88ca [stdlib] String : RangeReplaceableCollectionType
Addresses <rdar://problem/17860946> Full Array mutation APIs for String and UnicodeScalarView

Swift SVN r20980
2014-08-03 22:02:42 +00:00
Dmitri Hrybenko
aaaedefb63 stdlib/pointer types: give all pointers to objects (COpaquePointer,
Unsafe*Pointer) equivalent APIs, and change the initializer from a bare integer
to require a 'bitPattern:' label.

rdar://17895306


Swift SVN r20979
2014-08-03 21:47:31 +00:00
Dave Abrahams
9bec796c94 [stdlib] Lazy and eager concatenate
Swift SVN r20978
2014-08-03 21:34:28 +00:00
Dmitri Hrybenko
6e401c20ca stdlib: add a mirror for the Unicode scalar String view
Swift SVN r20977
2014-08-03 20:01:34 +00:00
Dmitri Hrybenko
4c0075f5bd stdlib: fix mirrors for UTF8 and UTF16 String views so that they actually work
instead of causing a stack overflow

rdar://17897212


Swift SVN r20974
2014-08-03 19:44:17 +00:00
Dmitri Hrybenko
5746e4e9ca stdlib: rename _fatalError to _sanityCheckFailure. Name similarity between
fatalError and _fatalError has caused some damage already, as some
memory-safety checks in Mirrors are _fatalErrors.


Swift SVN r20969
2014-08-03 15:20:37 +00:00
Dmitri Hrybenko
6d4f8adbf5 stdlib/String: fix a race in _StringBuffer.grow()
rdar://17855614


Swift SVN r20960
2014-08-02 22:50:45 +00:00
Dmitri Hrybenko
2688dd426f stdlib/Print test: simplify code
Swift SVN r20954
2014-08-02 17:11:50 +00:00
Dave Abrahams
f270a5b6f3 [stdlib] _StringCore : RangeReplaceable
Swift SVN r20947
2014-08-02 05:44:40 +00:00
Dave Abrahams
69482f3fdb [stdlib] make test workaround not platform-sensitive
Swift SVN r20937
2014-08-02 01:11:58 +00:00
Dave Abrahams
23ee8d34be [stdlib] Make Array RangeReplaceable test generic
...and uncover memory leaks in the process: <rdar://problem/17892507>

Swift SVN r20936
2014-08-02 01:08:57 +00:00
Doug Gregor
c593d49b08 Rework the _ObjectiveCBridgeable to use inout parameters rather than returns.
The _forceBridgeFromObjectiveC and _conditionallyBridgeFromObjectiveC
requirements of the _ObjectiveCBridgeable protocol previously returned
Self and Self?, respectively, where 'Self' is the value type that is
bridged. This use of returns is fairly hostile to the idea of calling
the witnesses for these requirements from the C++ part of the runtime,
leading to "interesting" tricks with OpaqueExistentialContainer that
made it hard to use these witnesses within the dynamic casting
infrastructure.

Replace the returns with inout Self? parameters, which are far easier
to deal with in the C++ part of the runtime. Despite the churn because
we're changing the _ObjectiveCBridgeable protocol, this is NFC.

Swift SVN r20934
2014-08-02 01:03:41 +00:00
Joe Pamer
0896a12197 Further improve type checker diagnostics through a variety of means.
Start capitalizing on some of the new diagnostic machinery in a few different ways:
- When mining constraints for type information, utilize constraints "favored" by the overload resolution process.
- When printing type variables, if the variable was created by opening a literal expression, utilize the literal
  default type or conformance if possible.
- Utilize syntactic information when crafting diagnostics:
	- If the constraint miner can produce a better diagnostic than the recorded failure, diagnose via constraints.
	- Factor in the expression kind when choosing which types to include in a diagnostic message.
- Start customizing diagnostics based on the amount of type data available.

What does all this mean?
- Fewer type variables leaking into diagnostic messages.
- Far better diagnostics for overload resolution failures. Specifically, we now print proper argument type data
  for failed function calls.
- No more "'Foo' is not convertible to 'Foo'" error messages
- A greater emphasis on type data means less dependence on the ordering of failed constraints. This means fewer
  inscrutable diagnostics complaining about 'UInt8' when all the constituent expressions are of type Float.

So we still have a ways to go, but these changes should greatly improve the number of head-scratchers served up
by the type checker.

These changes address the following radars:
rdar://problem/17618403
rdar://problem/17559042
rdar://problem/17007456
rdar://problem/17559042
rdar://problem/17590992
rdar://problem/17646988
rdar://problem/16979859
rdar://problem/16922560
rdar://problem/17144902
rdar://problem/16616948
rdar://problem/16756363
rdar://problem/16338509

Swift SVN r20927
2014-08-01 23:32:19 +00:00
Dave Abrahams
94623d6d3c [stdlib] ...and remove the stray printlns, too
Swift SVN r20926
2014-08-01 23:04:00 +00:00
Dave Abrahams
921045c7f8 [stdlib] Enable commented test part
As I was reducing a test case for a typechecker bug, I ended up
commenting out important test code in the regression suite.  This
restores it (and makes it work).

Swift SVN r20925
2014-08-01 23:01:02 +00:00
Dmitri Hrybenko
22044b09f3 stdlib/Assert test: don't run tests where we execute 'unreachable' LLVM
IR instruction; we are not guaranteed to crash, instead the code can
enter an infinite loop which will cause the test to time out

Swift SVN r20924
2014-08-01 22:51:26 +00:00
Dave Abrahams
1f8ec23ebe [stdlib] Correct/test _StringCore.reserveCapacity
The old one could never have worked.

Swift SVN r20916
2014-08-01 21:35:15 +00:00
Dave Abrahams
00dd90d9df [stdlib] Robustify _StringCore extensibility test
Swift SVN r20898
2014-08-01 17:27:28 +00:00
Dmitri Hrybenko
142a32a944 stdlib/Assert: allow string interpolation in assertion messages
rdar://17248446


Swift SVN r20892
2014-08-01 13:44:38 +00:00
Dmitri Hrybenko
a79339ee8f stdlib/Assert: adopt new names for trapping functions:
assert() / assertionFailure() -- debug mode
precondition() / preconditionFailure() -- debug and release modes
fatalError() -- always traps


Swift SVN r20890
2014-08-01 10:22:23 +00:00
Dave Abrahams
8419d20f1c [stdlib] ImplicitlyUnwrappedOptional is not Boolean
Swift SVN r20839
2014-07-31 18:40:29 +00:00
Dmitri Hrybenko
c7a5b1daca stdlib/runtime: fix leaks in swift_bridgeNonVerbatimToObjectiveC
Swift SVN r20827
2014-07-31 15:49:17 +00:00
Dave Abrahams
ea21309150 [stdlib] _StringCore: ExtensibleCollectionType
Swift SVN r20825
2014-07-31 14:57:42 +00:00
Dmitri Hrybenko
8150b9296b stdlib: fix leaks of Swift.String when passing them from runtime to
Swift (in mirrors and demangling)

Swift SVN r20823
2014-07-31 14:48:54 +00:00
Dmitri Hrybenko
30749d9f69 stdlib/Reflection: really fix a leak when reflecting a class (turned out to be
in swift_ObjCMirror_count)

rdar://17840810


Swift SVN r20821
2014-07-31 13:11:55 +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
Dmitri Hrybenko
ec4f8d37f7 stdlib: fix a heap overflow that colud happen when appending to a string
slice

rdar://17855908

Swift SVN r20762
2014-07-30 18:04:36 +00:00
Dmitri Hrybenko
391fb8802e TrapTestPrototype: pass environment to the child process to allow the
test to pass on 32-bit iOS simulator

Swift SVN r20760
2014-07-30 15:17:52 +00:00
Greg Parker
fe8618a3d2 Scrap the custom allocator until we have time to fix it.
The allocator's crimes include:
* It uses OS SPI that must not be used by non-OS apps.
* It does not play well with memory debugging tools like Instruments.
* It does not return memory to the OS in response to memory pressure.
* It is less tested than we would like because many configurations 
  inadvertently turn it off (such as running from Xcode).
* Its per-thread magazine implementation does not actually work.
* Its "try alloc" flag is incompletely implemented and never used.
* Its "zero fill" flag is unimplemented and inconsistently used.



Swift SVN r20757
2014-07-30 14:11:40 +00:00
Greg Parker
3add65de36 [test] Fix un-terminated cstring in test stdlib/NSStringAPI.swift.
Swift SVN r20756
2014-07-30 14:11:24 +00:00
Greg Parker
4a33110d9c [test] Disable tuple printing test pending rdar://17855302.
Swift SVN r20754
2014-07-30 12:39:04 +00:00