Commit Graph

62 Commits

Author SHA1 Message Date
Mike Ash
0d14ab01ef [Test] Remove timeout from Reflection.swift and Reflection_objc.swift.
The timeouts have a comment about ASan tests taking hours, but that comment is a decade old and that doesn't seem to be the case now. Reflection_objc.swift does take over a minute to build with an ASan compiler, but that's tolerable.

rdar://134405526
2024-10-07 16:13:34 -04:00
Anthony Latsis
2a84083714 Add regression test to close #43211 2022-06-28 22:36:14 +03:00
Kuba (Brecka) Mracek
8b189d99e4 Turn off SWIFT_ENABLE_REFLECTION on the stdlib_minimal preset (#39030) 2021-09-12 18:54:53 -07:00
Luciano Almeida
c29fbb5528 [test] Adjusting test files where class syntax is used for protocol inheritance 2020-11-29 21:43:50 -03:00
Erik Eckstein
f83bd2885d tests: fix the timeout.py script and move it to a more central place
A string->float conversion for the command line argument was missing
2020-04-10 20:10:24 +02:00
Saleem Abdulrasool
6618ec17dd stdlib: replace shell script with python
Replace timeout.sh with timeout.py.  This makes it portable to other
platforms like Windows.
2018-12-11 17:28:39 -08:00
Arnold Schwaighofer
2d8a1dbbfe Codesign test/stdlib 2018-08-10 06:58:40 -07:00
taylor swift
c85880899d implement SE 184: add allocation methods to Unsafe buffer pointers, drop all parameters from deallocation, adjust namings, and add repeated-value assignment methods 2017-11-17 21:28:03 -08: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
practicalswift
fa7fbdb8b0 [gardening] Remove redundant nil-initialization of optional variable
From the Swift documentation:

"If you define an optional variable without providing a default value,
 the variable is automatically set to nil for you."
2016-09-18 07:40:07 +02: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
Anna Zaks
505257ae9b API Notes: This contains audit for most of AppKit!
Plus, smaller enhancements on the other frameworks.
Removes the need for _PrintableNSObjectType hack (rdar://problem/16883288)

Swift SVN r22185
2014-09-22 21:47:22 +00:00
Greg Parker
dfa498e1d5 [test] UIImage(contentsOfFile:) is now failable.
Swift SVN r21735
2014-09-05 00:48:07 +00:00
Greg Parker
b0e15c09c9 [test] Fix some optional handling chnaged by an API notes update.
Swift SVN r21346
2014-08-21 07:03:10 +00:00
Dmitri Hrybenko
d812966d32 stdlib: remove Optional.hasValue property
rdar://17931456


Swift SVN r21172
2014-08-13 10:51:26 +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
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
Dave Abrahams
10ee277fd0 Add a few missing bitPattern:'s
Swift SVN r20981
2014-08-03 22:38:56 +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
Dave Abrahams
6a80cbbaa2 [stdlib] Capitalize the cases of Bit
Fixes <rdar://problem/17821517>

Swift SVN r20718
2014-07-29 23:25:28 +00:00
Joe Pamer
94dac129d4 Remove the BooleanType conformance from optional types (rdar://problem/17110911)
To limit user confusion when using conditional expressions of type Bool?, we've decided to remove the BooleanType (aka "LogicValue") conformance from optional types. (If users would like to use an expression of type Bool? as a conditional, they'll need to check against nil.)

Note: This change effectively regresses the "case is" pattern over types, since it currently demands a BooleanType conformance. I've filed rdar://problem/17791533 to track reinstating it if necessary.

Swift SVN r20637
2014-07-28 19:20:39 +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
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
21669b3aee [stdlib] Add "Mutable" to [Autoreleasing]UnsafePointer
UnsafePointer becomes UnsafeMutablePointer
AutoreleasingUnsafePointer becomes AutoreleasingUnsafeMutablePointer

Swift SVN r20316
2014-07-22 16:56:23 +00:00
Dmitri Hrybenko
d14f17beef Change 'getLogicValue()' into a property 'boolValue'; change
'getArrayBoundValue()' into a property 'arrayBoundValue'.

rdar://17156123


Swift SVN r20304
2014-07-22 12:08:10 +00:00
Greg Parker
5209dab8c0 [test] Update tests now that NSStringFromClass() returns demangled names.
Swift SVN r20204
2014-07-19 01:53:26 +00:00
Enrico Granata
e4cfd3ae0a Reflect ranges in the half-open format - it's not always consistent with what the user typed, but at least it resembles language syntax, and is more consistent with what LLDB already does too. Last chunk of work for rdar://16117421
Swift SVN r20168
2014-07-18 18:26:17 +00:00
Doug Gregor
a5c079af59 Replace the class_protocol attribute with a "class" requirement.
This only tackles the protocol case (<rdar://problem/17510790>); it
does not yet generalize to an arbitrary "class" requirement on either
existentials or generics.

Swift SVN r19896
2014-07-13 06:57:48 +00:00
Dave Abrahams
6d1095f44e Protocol names end in "Type," "ible," or "able"
Mechanically add "Type" to the end of any protocol names that don't end
in "Type," "ible," or "able."  Also, drop "Type" from the end of any
associated type names, except for those of the *LiteralConvertible
protocols.

There are obvious improvements to make in some of these names, which can
be handled with separate commits.

Fixes <rdar://problem/17165920> Protocols `Integer` etc should get
uglier names.

Swift SVN r19883
2014-07-12 17:29:57 +00:00
Enrico Granata
2cd27ad3d2 Tweaks to get PlaygroundLogger to build and work in a world of accessibility-enforced rules
1) Add an ObjCObject disposition that tells us this Mirror is reflecting upon an ObjC-imported type
2) Change the default summary of _ClassMirror and _StructMirror to be the mangled typename, with no children count



Swift SVN r19817
2014-07-10 18:54:25 +00:00
Dave Abrahams
9918145209 [stdlib] Drop RandomAccessRange
It won't be needed in the new Range plan after all

Swift SVN r19770
2014-07-10 01:20:56 +00:00
Enrico Granata
4fd20e7064 Use The Mirror Generator to simplify the CoreGraphics mirrors - a little bit of magic, but much less boilerplate
Oh, and add a test case for those Mirrors, since none was there



Swift SVN r19653
2014-07-08 00:17:06 +00:00
Enrico Granata
b0548f13cd Start using the Mirror Generator
This commit removes Mirrors for RangeGenerators, since Dave and I discussed that these won't be necessary in practice
Also, it removes the Mirrors for Range types from Range.swift.gyb, and instead adds a new RangeMirrors.swift.gyb used to generate range types Mirrors



Swift SVN r19543
2014-07-03 23:43:14 +00:00
Enrico Granata
9abfdb372e Add a Mirror for UnsafePointer
The one design choice here was whether to expose the pointee directly through the Mirror

My choice was against that. Instead, we present UnsafePointer as UnsafePointer(0x123) and the child we expose is the 0x123 numeric pointer value

The other option, of course, would be to present it as UnsafePointer(reflect(memory)) - but that seems risky to do by default
UnsafePointers are allowed to be in, guess what, unsafe states, and the stakes of having playgrounds try and dereference at all times are quite too high.

If the user really wants to reflect the pointee reflect(pointer.memory) will do it for them - and then any crashes will be theirs to enjoy.

Of course, I am very open to arguments as to why reflect(memory) would be a better choice.



Swift SVN r19386
2014-07-01 00:54:52 +00:00
Enrico Granata
0f706ba86c Add a Mirror for EmptyCollection. Oh, and test cases too.
Swift SVN r19380
2014-06-30 23:21:08 +00:00
Enrico Granata
b97490b139 Add a test for the CollectionOfOne Mirror
Swift SVN r19365
2014-06-30 20:30:05 +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
Enrico Granata
c696acfefb Add mirrors for Range and related objects. The format of the output is clearly not final; Also, test case
Swift SVN r19208
2014-06-26 01:15:32 +00:00
Enrico Granata
4854ddf73f Add a test that the UInt Mirror does the right thing
Swift SVN r18987
2014-06-18 23:00:16 +00:00
Argyrios Kyrtzidis
085c126266 [test] For 'test/stdlib/Reflection.swift' remove unnecessary #if's and code duplication.
Swift SVN r18673
2014-05-30 20:27:07 +00:00
Joe Groff
1efc2d9fae Reflection: Fall back to using ObjC metadata to get field offsets in ObjC-derived class mirrors.
Our runtime doesn't fix up class field offset vectors for resilient ObjC base classes, causing the offsets to be wrong if the actual size of the base class differs from its compile-time claimed size. Use the ObjC runtime's ivar records instead if the class has ObjC heritage. We can't do this all the time because the ObjC ivar records aren't yet trustworthy for generic classes, but we don't fully support the mix of ObjC heritage and genericity very well anyway yet. Fixes <rdar://problem/17027510> in the short term.

Swift SVN r18622
2014-05-24 23:14:10 +00:00
Argyrios Kyrtzidis
7230c0f031 [test] Remove a "#if os(OSX)" check from test/stdlib/Reflection.swift, that section can apply and pass the test on iOS as well.
Swift SVN r18619
2014-05-24 16:00:52 +00:00
Enrico Granata
1e5b65cacb Improve the switch statement in this test case to be more idiomatic
Thanks Joe!



Swift SVN r18610
2014-05-24 01:09:19 +00:00
Enrico Granata
0134c6d197 Allow user-defined Swift classes to implement our API for QuickLooks, and have the result of that API be picked up by the Mirrors
This is our public API for how quicklooks work in the debugger, and the plan is to have this same API work in playgrounds as well

Fixes rdar://17023157


Swift SVN r18609
2014-05-24 01:00:46 +00:00
Enrico Granata
22329b3ac2 Extend the _OpaqueMirror to produce summaries that at least reflect the broad category of value being reflected
The <opaque> output is clearly useless, and annoying to see scattered around playgrounds

We don't have bandwidth right now to produce detailed useful reflection information, but at least show a basic understanding of data

Fixes part of rdar://17018392



Swift SVN r18607
2014-05-23 23:23:43 +00:00