Commit Graph

43 Commits

Author SHA1 Message Date
Kavon Farvardin
0420310623 NCGenerics: it's no longer "experimental"
resolves rdar://127701059
2024-05-08 10:49:12 -07:00
Kavon Farvardin
ff3ea642b1 NCGenerics: increase baseline test coverage
During feature bringup, it's handy to have tests always running in CI to prevent outside regressions.
2024-02-20 18:26:05 -05:00
Anthony Latsis
af66096847 Gardening: Migrate test suite to GH issues: Interpreter 2022-09-01 06:35:57 +03:00
Karoy Lorentey
e2cfab4f28 [stdlib][test] Adopt availability macros in tests 2021-10-31 15:00:58 -07:00
Mishal Shah
a3cd8bc9e9 [Tests] Codesign the binary before executing the test 2020-08-07 00:26:07 -07:00
tbkka
f989aa2b22 SR-12486: T.self is Any.Protocol is broken (#31662)
* SR-12486: `T.self is Any.Protocol` is broken

This turned out to be fallout from https://github.com/apple/swift/pull/27572
which was in turn motivated by our confusing metatype syntax when generic variables are bound to protocols.

In particular, the earlier PR was an attempt to make the expression
`x is T.Type` (where `T` is a generic type variable bound to a protocol `P`)
behave the same as
`x is P.Type` (where `P` is a protocol).
Unfortunately, the generic `T.Type` actually binds to `P.Protocol` in this case (not `P.Type`), so the original motivation was flawed, and as it happens, `x is T.Type` already behaved the same as `x is P.Protocol` in this situation.

This PR reverts that earlier change and beefs up some of the tests around these behaviors.

Resolves SR-12486

Resolves rdar://62201613

Reverts PR#27572
2020-07-02 13:10:01 -07:00
Mishal Shah
272c466e47 Update master to build with Xcode 12 beta 2020-06-22 15:43:20 -07:00
Mishal Shah
e7cd5ab17f Update master to build with Xcode 11.4 2020-03-24 11:30:45 -07:00
tbkka
74df8725ab SR-12161 Casting P.self to P.Type regressed in iOS13.4 beta (#29779)
* SR-12161 Casting P.self to P.Type regressed in iOS13.4 beta

An earlier fix for certain protocol casts inadvertently disabled
the check for a protocol being cast to its own metatype.
This rearranges the code so that identical types always succeed.
It also updates swift_dynamicCastMetatypeUnconditional to
include recent changes to swift_dynamicCastMetatype.

Note: These fixes only apply to debug/non-optimized builds.
Cast optimizations still break a lot of these cases.
2020-02-12 14:24:31 -08:00
Mike Ash
fb200e6159 [Test] Fix generic_casts and generic_casts_objc for back-deployment testing.
When we're testing against a runtime that doesn't have the fix, just fake the correct results.

rdar://problem/56375164
2019-10-21 16:36:06 -04:00
Mike Ash
b05e0099f8 [Test] Make sure generic_casts.swift tests an unoptimized build of the test even when --test-optimized is passed.
rdar://problem/56044443
2019-10-15 15:49:03 -04:00
Mike Ash
0aab6d2368 [Test] Remove --dump-input fail from generic_casts.swift.
rdar://problem/56044443
2019-10-11 17:25:46 -04:00
Mike Ash
6a3eecb79c [Test] Split out the @objc bits of the new generic_casts.swift code.
rdar://problem/56044443
2019-10-11 13:15:57 -04:00
Mike Ash
3ff277d31d [Runtime] Use _conformsToProtocols instead of manually checking protocol conformance.
This is cleaner and it fixes a bunch of cases the old code didn't handle: @objc protocols, class bounds, and superclass constraints.

rdar://problem/56044443
2019-10-10 14:14:41 -04:00
Mike Ash
d56173eb14 [Runtime] Handle existential target types in swift_dynamicCastMetatypeImpl.
This fixes cases like `type is T.Type` when T is generic specialized to a protocol type.

Note: the compiler can still optimize these checks away and will optimize this check down to `false` in some cases. We'll want to fix that as well.

rdar://problem/56044443
2019-10-08 11:37:39 -04:00
sarveshtamba
0764671915 Changes for test failures on PowerPC64LE when running as non-root user
This test case was earlier marked as XFAIL since it was failing when run as root users( #21541 ). However, this test case now passes successfully when run as non-root(normal) user. Submitting this changeset/pull request since the test suite proceeds ahead to other test suites like those for TestFoundation, etc as non-root(normal) user successfully. Please review and approve.
2019-03-04 12:50:55 +05:30
sarveshtamba
7cb42b740c Changes for #SR-9413:Swift 5.0 test failures on PowerPC #21541 2019-01-16 11:05:02 +00:00
sarveshtamba
56318f3e1f Changes for #SR-9413:Swift 5.0 test failures on PowerPC 2018-12-24 11:37:38 +00:00
Mike Ash
798edb9d0e [Runtime][Stdlib][Overlays] Rename various Objective-C classes and methods that would conflict when loading old Swift libraries into a process alongside ABI-stable libraries.
rdar://problem/35768222
2018-09-13 16:55:10 -04:00
Arnold Schwaighofer
6eca97add6 Codesign test/Interpreter 2018-08-10 06:58:40 -07:00
Lily Vulcano
1377ab7d7e Turn on ‘as’ bridging on Darwin. 2018-05-30 15:07:22 -07:00
Ben Langmuir
628b6a1fc7 Revert "Turn on ‘as’ bridging on Linux." 2018-05-17 14:54:35 -07:00
Lily Vulcano
b9455930ee Turn on ‘as’ bridging on Darwin. 2018-05-17 09:59:39 -07:00
John McCall
b937bdf717 Dynamic casts to AnyObject should succeed for an arbitrary source
type because we can always make a SwiftValue.

rdar://26268575
2016-08-19 10:36:18 -07:00
Dmitri Gribenko
d175b3b66d Migrate FileCheck to %FileCheck in tests 2016-08-10 23:52:02 -07:00
Robert Widmann
4f465224ea Polish off uses of dynamicType in tests 2016-07-29 16:59:14 -07:00
Joe
a6dad0091b [SE-0095] Initial parsing implementation for '&' composition syntax
This commit defines the ‘Any’ keyword, implements parsing for composing
types with an infix ‘&’, and provides a fixit to convert ‘protocol<>’

- Updated tests & stdlib for new composition syntax
- Provide errors when compositions used in inheritance.
Any is treated as a contextual keyword. The name ‘Any’
is used emit the empty composition type. We have to
stop user declaring top level types spelled ‘Any’ too.
2016-07-19 12:01:02 -07:00
Manav Gabhawala
7928140f79 [SE-0046] Implements consistent function parameter labels by discarding extraneous parameter names and adding _ where necessary 2016-04-06 20:21:58 -04:00
Arnold Schwaighofer
f7771859d8 Rename the optimize_test feature to executable_test and document that feature.
Swift SVN r29213
2015-06-01 23:44:13 +00:00
Arnold Schwaighofer
3643c614a3 Run tests in optimize test modes
This runs all files that have a target-build-swift or target-run-stdlib-swift
RUN line in optimize test mode.

Swift SVN r29206
2015-06-01 21:23:31 +00:00
Dmitri Hrybenko
f46f16ae82 stdlib: implement new print() API
rdar://20775683

Swift SVN r28309
2015-05-08 01:37:59 +00:00
Graham Batty
83b4384fac Update test flags for linux failures and support.
Also removed the sdk 'feature' in favour of the more specific
objc_interop.

Swift SVN r24856
2015-01-30 21:31:48 +00:00
Joe Groff
7e78ff68d1 IRGen/Runtime: Make dynamic metatype-to-AnyObject casts work.
Bonus fix for rdar://problem/19624697.

Swift SVN r24808
2015-01-28 23:06:45 +00:00
Joe Groff
bf9a17bef3 IRGen: Don't emit a check for class-to-AnyObject "checked" casts.
They don't need one, and nobody really conforms to the AnyObject sham protocol at runtime. Fixes rdar://problem/19624697, though there's going to be a similiar problem with metatype-to-AnyObject casts that needs fixing as well.

Swift SVN r24802
2015-01-28 19:26:17 +00:00
Joe Groff
04f44ba038 SIL: Classify potentially bridgeable checked casts as MaySucceed.
Fixes rdar://problem/19482567.

Swift SVN r24773
2015-01-28 02:14:35 +00:00
Chris Willmore
03a6190a1f <rdar://problem/19031957> Change failable casts from "as" to "as!"
Previously the "as" keyword could either represent coercion or or forced
downcasting. This change separates the two notions. "as" now only means
type conversion, while the new "as!" operator is used to perform forced
downcasting. If a program uses "as" where "as!" is called for, we emit a
diagnostic and fixit.

Internally, this change removes the UnresolvedCheckedCastExpr class, in
favor of directly instantiating CoerceExpr when parsing the "as"
operator, and ForcedCheckedCastExpr when parsing the "as!" operator.

Swift SVN r24253
2015-01-08 00:33:59 +00:00
Graham Batty
83f27a8af7 Revert "Mark tests that don't pass on linux as XFAIL."
This reverts commit 2711ca86de7bf6a7885ccea24219a48a590b1e95.

Swift SVN r23577
2014-11-24 17:42:13 +00:00
Graham Batty
198402dcfe Mark tests that don't pass on linux as XFAIL.
Swift SVN r23573
2014-11-24 17:40:37 +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
Doug Gregor
67ca1c9ea1 Implement the new casting syntaxes "as" and "as?".
There's a bit of a reshuffle of the ExplicitCastExpr subclasses:
  - The existing ConditionalCheckedCastExpr expression node now represents
"as?". 
  - A new ForcedCheckedCastExpr node represents "as" when it is a
  downcast.
  - CoerceExpr represents "as" when it is a coercion.
  - A new UnresolvedCheckedCastExpr node describes "as" before it has
  been type-checked down to ForcedCheckedCastExpr or CoerceExpr. This
  wasn't a strictly necessary change, but it helps us detangle what's
  going on.

There are a few new diagnostics to help users avoid getting bitten by
as/as? mistakes:
  - Custom errors when a forced downcast (as) is used as the operand
  of postfix '!' or '?', with Fix-Its to remove the '!' or make the
  downcast conditional (with as?), respectively.
  - A warning when a forced downcast is injected into an optional,
  with a suggestion to use a conditional downcast.
  - A new error when the postfix '!' is used for a contextual
  downcast, with a Fix-It to replace it with "as T" with the
  contextual type T.

Lots of test updates, none of which felt like regressions. The new
tests are in test/expr/cast/optionals.swift. 

Addresses <rdar://problem/17000058>


Swift SVN r18556
2014-05-22 06:15:29 +00:00
Joe Groff
edb2c0c411 Runtime: Handle dynamic casts to AnyObject.
We can't do existential casts generally yet, but we can at least handle class-to-AnyObject casts, which come up in array bridging. Fixes <rdar://problem/16898943>.

Swift SVN r18033
2014-05-13 22:31:23 +00:00
Ted Kremenek
fad874708e Adjust test cases.
Swift SVN r17964
2014-05-12 22:01:52 +00:00
Joe Groff
589ff562d0 Add interpreter test for archetype and existential casts.
Swift SVN r5686
2013-06-19 19:13:57 +00:00