Commit Graph

36 Commits

Author SHA1 Message Date
Enrico Granata
3386d89af4 When demangling as string type names that come from module names of the form __lldb_expr_<something> in a Swift program, hide the module
The __lldb_expr modules are special as in they are autogenerated by LLDB and meant to not be user-accessible, so showing them adds visual noise for no user benefit

I am open to the notion of adding a flag to swift-demangle to the same effect, but that seems much lower priority



Swift SVN r28195
2015-05-06 02:49:08 +00:00
Dave Abrahams
65be672a0c [stdlib] Adjust expected output of legacy mirror tests
Now that we're reflecting base classes, things have changed a bit.

Swift SVN r28160
2015-05-05 07:43:49 +00:00
Devin Coughlin
0c82636156 Runtime: Enable run-time availability checks for tvOS
Change _stdlib_isOSVersionAtLeast on tvOS to actually check the running
OS version rather than always returning false. It still always returns false on
watchOS; rdar://problem/20234735 tracks that.

rdar://problem/20663303

Swift SVN r28024
2015-05-01 05:10:47 +00:00
Doug Gregor
793b3326af Implement the new rules for argument label defaults.
The rule changes are as follows:
  * All functions (introduced with the 'func' keyword) have argument
  labels for arguments beyond the first, by default. Methods are no
  longer special in this regard.
  * The presence of a default argument no longer implies an argument
  label.

The actual changes to the parser and printer are fairly simple; the
rest of the noise is updating the standard library, overlays, tests,
etc.

With the standard library, this change is intended to be API neutral:
I've added/removed #'s and _'s as appropriate to keep the user
interface the same. If we want to separately consider using argument
labels for more free functions now that the defaults in the language
have shifted, we can tackle that separately.

Fixes rdar://problem/17218256.

Swift SVN r27704
2015-04-24 19:03:30 +00:00
Devin Coughlin
8c7d3cc0cb Runtime: Change runtime to use lexicographic version comparison for availability
Change the runtime so that version comparisons use a lexicographic rather
than a component-wise comparison.

rdar://problem/20661965

Swift SVN r27669
2015-04-24 02:20:11 +00:00
Joe Groff
79ee6f21c4 Runtime: Recognize class and @objc existential metatypes as class instances in swift_isClassOrObjCExistential.
Fixes rdar://problem/20131232.

Swift SVN r27534
2015-04-21 18:24:10 +00:00
Joe Groff
c0a2994564 AST: Start printing function types with @convention instead of old attributes.
And update tests to match.

Swift SVN r27262
2015-04-13 22:51:34 +00:00
Dave Abrahams
ac3f047496 [stdlib] Renaming fallout from Mirror API review
toString(x)      => String(x)
toDebugString(x) => String(reflecting: x)
Printable        => CustomStringConvertible
DebugPrintable   => CustomDebugStringConvertible

Also updated comments to clarify these protocols

Swift SVN r27090
2015-04-07 20:32:26 +00:00
Dmitri Hrybenko
ff2dd6320a stdlib: fix coding style
When colon specifies is-a relationship between types, we put spaces on
both sides of the colon.

Swift SVN r27016
2015-04-05 05:54:55 +00:00
Joe Groff
7514921a86 Runtime: Remove obsolete _stdlib_conformsToProtocol function.
'x is P' works now, and this function isn't used anywhere except by a test that exercises it. Removing this also lets us remove a swath of otherwise unused helper static functions in the runtime.

Swift SVN r26618
2015-03-27 02:08:58 +00:00
Dmitri Hrybenko
9b9748ffb0 Add a more comprehensive test for StaticString mirror
Swift SVN r26135
2015-03-14 09:09:52 +00:00
Enrico Granata
561dfce598 Add a test case for the Reflectable conformance for StaticString
Swift SVN r26058
2015-03-12 20:27:50 +00:00
Dmitri Hrybenko
6ae1dc19f8 Add tests for printing Any, AnyObject and AnyClass
rdar://19778210

Swift SVN r26046
2015-03-12 08:47:27 +00:00
Joe Groff
9dca554a79 Tests for ±conformsToProtocol: on native Swift classes.
Swift SVN r25505
2015-02-24 18:50:45 +00:00
Maxwell Swadling
9e68b3cbfd [stdlib] fixed segfault when appending to bridged arrays(?)
I'm still not sure how this is the problem.

Fixes rdar://problem/19773488

Swift SVN r25386
2015-02-19 01:03:08 +00:00
Dmitri Hrybenko
5f49574f28 Add tests for custom mirrors
Swift SVN r25234
2015-02-12 11:26:02 +00:00
Joe Groff
bb9fa13313 Runtime: Fix overrelease in swift_stdlib_NSString{Lower,Upper}caseString.
And change the NoLeak tests to scope things inside autoreleasepool { } instead of if true { } blocks so we don't miss canaries masked by autoreleases. Fixes rdar://problem/19801253 (and very likely many of the overrelease crashers we've been seeing).

Swift SVN r25213
2015-02-12 01:04:40 +00:00
Maxwell Swadling
266acda5bc moved reflection test to Runtime.swift
Swift SVN r25207
2015-02-11 23:41:59 +00:00
Dave Abrahams
b4c4b30f27 [stdlib] Don't leak CF dependency from core stdlib
Carefully track the functions that inject these dependencies, so all
functions that use them can be protected with

  @inline(never) @semantics("stdlib_binary_only")

To do this, we introduce a naming convention: the _stdlib_binary_ prefix
distinguishes functions dependent on external frameworks.  All callers
of such functions must adopt either the naming convention, or the
attributes above.

This change should unbreak the build.

Swift SVN r25020
2015-02-06 00:48:16 +00:00
Joe Groff
1d9d153136 IRGen: Consistently mangle protocol names in protocol descriptors with the _Tt prefix.
Since protocol descriptors look like ObjC Protocol objects, we want to mangle the type prefix into their names to make them obviously Swift mangled names, but we were only doing this for @objc protocols, not native protocols. For consistency, do the same thing with native descriptors, and update the runtime type display code to match. Fixes rdar://problem/19691574.

Swift SVN r25014
2015-02-05 20:04:20 +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
Dmitri Hrybenko
bbf79427ac stdlib: remove bitwise operations on Bool
Bitwise operations on Bool are redundant with other logic operations
that stdlib already provides.  The only reason to have them was to avoid
branching in the short-circuiting && and ||.

rdar://19340952

Surprisingly, replacing & and | in the standard library with && and ||
brought performance improvements and no significant performance
regressions:

RecursiveOwnedParameter 1.14
SelectionSort 1.19

Swift SVN r24674
2015-01-23 03:09:55 +00:00
Greg Parker
04f6a6b4aa [test] Remove test workarounds for rdar://19537198 and add a new test for it.
Swift SVN r24588
2015-01-21 04:05:18 +00:00
Greg Parker
cc4db80252 [test] Temporarily disable Reflection.Unmanaged/not-nil test on arm64.
rdar://19537198.


Swift SVN r24567
2015-01-20 21:30:50 +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
Dmitri Hrybenko
e87bcff79d stdlib: move String.{lowercaseString,uppercaseString} to the core
library

Swift SVN r23936
2014-12-15 09:47:03 +00:00
Maxwell Swadling
63462e64d0 [stdlib] Added ASCII fast path for string hashing
Swift SVN r23896
2014-12-12 22:22:58 +00:00
Joe Groff
ee5adc1f6e Runtime: Provide reflection for metatypes.
Metatypes have no user-visible structure, but can at least summarize as their type names. This gives us reasonable ad-hoc Printable behavior (thought debugPrint is still wrong, since a type name isn't parsable without being .self'ed).

Swift SVN r23745
2014-12-05 22:58:44 +00:00
Joe Groff
1cf1b4172b Runtime: Use full demangled names when reflecting values.
Use the recursive demangled name generation I implemented in _typeName for metatypes in _stdlib_getDemangledType as well, so that we get fully-qualified generic names and other goodness.

Swift SVN r23743
2014-12-05 21:25:50 +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
Maxwell Swadling
5fc0b53484 Re-added dynamic casting tests
Swift SVN r23387
2014-11-17 21:35:35 +00:00
Maxwell Swadling
5f75d2dca8 Removed _stdlib_dynamicCastToExistential1 hack
It is no longer required.

Swift SVN r23379
2014-11-17 20:56:41 +00:00
Maxwell Swadling
10464d0478 Added Comparable to ObjectIdentifier
Swift SVN r23172
2014-11-08 02:06:24 +00:00
Dave Abrahams
ebde372ef9 [stdlib] Add space to Core Graphics type printing
Core Graphics mirrors were emitting textual representations without
spaces following commas separating values.  This commit fixes that
issue.

Swift SVN r22897
2014-10-23 20:50:09 +00: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