Commit Graph

14 Commits

Author SHA1 Message Date
Tim Kientzle
8cc0fe73d7 Allow "incomplete hashing" when testing ObjC bridged objects
Swift objects can implement Equatable without implementing
Hashable.  Obj-C NSObject always provides both.

Now that we bridge Swift Equatable to Obj-C `-isEqual:`,
we have to be conservative with how we expose `-hash`
for Swift types that are Equatable but not Hashable.
This looks like "incomplete hashing" of such types.
2023-10-31 11:37:10 -07:00
Doug Gregor
169dbcdc17 Revert "Disable a test to unblock CI"
This reverts commit 29a6d1066e.
2019-12-13 23:55:13 -08:00
Doug Gregor
905c830c45 [Runtime] Handle Error bridging as a last chance to cast to NSError/NSObject.
Rather than attempting Error bridging early when trying to dynamically
cast to NSError or NSObject, treat it as the *last* thing we do when
all else fails. Push most of this code over into Objective-C-specific
handling rather than #ifdef'd into the main casting logic to make that
slightly more clear.

One oddity of Error/NSError bridging is that a class that conforms to
Error can be dynamically cast to NSObject via Error bridging. This has
always been known to the static compiler, but the runtime itself was
not always handling such a cast uniformly. Do so now,
uniformly. However, this forced us to weaken an assertion, because
casting a class type to NSError or NSObject can produce an object with
a different identity.

Fixes rdar://problem/57393991.
2019-12-13 23:55:13 -08:00
Doug Gregor
8261d6f57e [Test] Go through the runtime for the "as? NSObject" check.
This prevents runtime differences on as? from affecting this test.
2019-12-13 23:55:13 -08:00
Doug Gregor
7f50537933 Revert "[Constraint application] Stop optimizing casts in the AST." 2019-11-21 09:19:04 -08:00
Erik Eckstein
29a6d1066e Disable a test to unblock CI
rdar://problem/57393991
2019-11-21 16:23:21 +01:00
Doug Gregor
f95f8e9a7b [Test] Go through the runtime for the "as? NSObject" check.
This prevents runtime differences on as? from affecting this test.
2019-11-20 16:53:59 -08:00
Karoy Lorentey
666a22feff [test] Modernize hashing throughout the test suite 2018-11-29 17:38:29 +00:00
Arnold Schwaighofer
2d8a1dbbfe Codesign test/stdlib 2018-08-10 06:58:40 -07:00
Joe Groff
78b5ff8b6b Runtime: Bridge Error-conforming types to id as NSError instances.
NSError is a more useful box for a swift Error than the generic box. Fixes rdar://problem/38631791 | SR-7232.
2018-04-10 12:23:49 -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
Greg Parker
cfee4d9c5e [runtime] Fix some casts of _SwiftValue (#8457)
* [runtime] Fix some casts of _SwiftValue.

* Allow _SwiftValue to be cast to NSObject by yielding the box object itself.
* Failed casts from NSDictionary containing _SwiftValue should not crash.

SR-4306, rdar://31197066
2017-04-10 14:31:35 -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