Commit Graph

745 Commits

Author SHA1 Message Date
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
0a04eddac1 [test] Disable part of submodules_smoke_test on iOS due to OpenGL differences.
Swift SVN r20302
2014-07-22 09:38:06 +00:00
Jordan Rose
f7b4f167dd [test] Fix submodules_smoke_test.swift to actually build the file.
Swift SVN r20300
2014-07-22 06:03:21 +00:00
Dave Abrahams
2c3ab47cf2 [stdlib] O(1) Array<non-verbatim> round-tripping
Arrays of non-verbatim-bridged types (such as Int, and today's String)
are converted to Objective-C lazily, with the objects created due to
element conversion being autoreleased when necessary.

Fixes <rdar://problem/17360154>

Note: test/SIL/Parser/array_roundtrip.swift was XFAIL'd;
see <rdar://problem/17758203>

Swift SVN r20293
2014-07-22 04:42:47 +00:00
Greg Parker
ecd3cbb838 [test] One more @objc -> dynamic change.
Swift SVN r20292
2014-07-22 02:45:46 +00:00
Jordan Rose
58befc46e2 [ClangImporter] Handle submodule imports.
Specifically, handle them by also importing the top-level module. This is
unfortunate, but at least lets people /access/ things in explicit submodules,
even if it doesn't let them limit their import to a specific submodule.

    (swift) import OpenGL.GL3
    (swift) glGetString
    // r0 : (GLenum) -> ConstUnsafePointer<GLubyte> = (Function)
    (swift) OpenGL.glGetString
    // r1 : (GLenum) -> ConstUnsafePointer<GLubyte> = (Function)

One unfortunate side effect of having a single Clang ASTContext is that if
one Swift module imports a Clang submodule, every Swift module can now see
it. That means /mixing/ incompatible submodules, such as OpenGL.GL and
OpenGL.GL3, still won't work. Filed <rdar://problem/17756745> for that.

<rdar://problem/13140302>

Swift SVN r20288
2014-07-22 01:31:17 +00:00
Doug Gregor
4c49802c15 Drop the ~= overload for NSObject <rdar://problem/17639977>.
Swift SVN r20254
2014-07-21 15:32:06 +00:00
Ted Kremenek
3075dee511 Mark 'NSConstantString' unavailable. Implements <rdar://problem/17306671>.
Swift SVN r20208
2014-07-19 05:14:06 +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
Greg Parker
b1edda0190 [test] Reinstate test KVO_dynamic.swift now that arclite is fixed.
Swift SVN r20203
2014-07-19 01:52:08 +00:00
Greg Parker
f771c11178 [test] Reinstate test autorelease.swift on armv7 now that llvm is fixed.
Swift SVN r20201
2014-07-19 01:49:07 +00:00
Greg Parker
2dfae9e347 [test] Disable KVO_dynamic temporarily. It's too inconsistent for XFAIL.
Swift SVN r20176
2014-07-18 20:34:20 +00:00
Greg Parker
69b2a8f878 [test] This XFAILed test apparently happens to pass on some platforms.
Swift SVN r20150
2014-07-18 11:12:35 +00:00
Greg Parker
06aee5d386 [test] Fix run commands for XFAILed test Interpreter/SDK/KVO_dynamic.swift.
Swift SVN r20149
2014-07-18 10:08:56 +00:00
Joe Groff
7e01ad3994 Add an XFAILed KVO-with-dynamic test as a reverse-canary for <rdar://problem/17697837>.
So we can see when Greg's objc4 and arclite fixes make it through the build system.

Swift SVN r20141
2014-07-18 04:43:48 +00:00
Joe Groff
55adb2eb77 Add SDK test for <rdar://problem/17653064>.
Swift SVN r20050
2014-07-16 22:13:29 +00:00
Dmitri Hrybenko
d125ac1e24 stdlib/runtime: stdlib casts to existentials: correctly project the buffer as
required

rdar://17628745


Swift SVN r20024
2014-07-16 15:17:46 +00:00
Greg Parker
7f80ba7de6 [test] XFAIL Interpreter/SDK/autorelease.swift on armv7 pending rdar://17694203
Swift SVN r20023
2014-07-16 12:08:58 +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
Joe Groff
34592229ff AppKit overlay: Make NSApplicationMain overlay public.
Enabling access control caused a regression in <rdar://problem/17577380>. Add a parse test so we don't regress again.

Swift SVN r19857
2014-07-11 18:48:55 +00:00
Jordan Rose
78fc120c27 Add a KVO execution test for r19851.
Swift SVN r19852
2014-07-11 17:22:49 +00:00
Enrico Granata
3dfff3a34d Fix tests that were broken by my last changes.
Swift SVN r19818
2014-07-10 19:15:38 +00:00
Chris Lattner
5b49d59c57 Remove the @ from @final and @lazy, the last major piece of
rdar://17168115.

Also, reinstate the ARM driver change and testcase that I removed
in my last patch.


Swift SVN r19790
2014-07-10 06:23:27 +00:00
Doug Gregor
c7adb497ba Blocks "are" classes, from the runtime perspective.
This allows arrays of blocks to be bridged at runtime
<rdar://problem/17035548>.

Swift SVN r19765
2014-07-10 00:12:14 +00:00
Doug Gregor
2f3f6acf21 Make "true" and "false" Boolean literal constants for the BooleanLiteralConvertible protocol.
Introduce the new BooleanLiteralConvertible protocol for Boolean
literals. Take "true" and "false" as real keywords (which is most of the
reason for the testsuite churn). Make Bool BooleanLiteralConvertible
and the default Boolean literal type, and ObjCBool
BooleanLiteralConvertible. Fixes <rdar://problem/17405310> and the
recent regression that made ObjCBool not work with true/false.


Swift SVN r19728
2014-07-09 16:57:35 +00:00
Doug Gregor
3a1e07e49b Improve type inference for the element pattern and sequence of a for-each loop.
This change pulls the handling of the element pattern and sequence of
a for-each loop into a single constraint system, so that we get type
inference between the two. Among other things, this allows one to
infer generic arguments within the element pattern from the sequence's
element type as well as allowing type annotations or the form of the
element pattern to affect overload resolution and generic argument
deduction for the sequence itself.


Swift SVN r19721
2014-07-09 06:00:55 +00:00
Doug Gregor
0d6df5f78d Remove Bool <-> ObjCBool conversions.
There's a regression here because we can no longer use "true" or
"false" with ObjCBool. We'll get that back when true and false become
literals.


Swift SVN r19694
2014-07-08 20:17:35 +00:00
Doug Gregor
e6a71b8363 Remove the implicit CFString -> String conversion
Swift SVN r19693
2014-07-08 20:07:49 +00:00
Doug Gregor
ed54826e1c Replace the implicit NSRange -> Range<Int> conversion with a toRange method
Swift SVN r19692
2014-07-08 20:05:09 +00:00
Doug Gregor
9e2b68c4f9 Introduce CGFloat as a distinct struct type.
CGFloat is 32-bit on 32-bit architectures and 64-bit on 64-bit
architectures for historical reasons. Rather than having it alias
either Float (32-bit) or Double (64-bit), introduce a distinct struct
type for CGFloat. CGFloat provides a complete set of comparisons and
arithmetic operators (including tgmath functions), initializers allows
explicit conversion between it an Int, UInt, Float, and Double, as
well as conforming to all of the protocols that Float/Double do.

This formulation of CGFloat makes use of CGFloat
architecture-independent, although it still requires a number of casts.
Fixes <rdar://problem/17224725>

Swift SVN r19689
2014-07-08 19:00:18 +00:00
Joe Groff
deaab5094d Add an execution test for extensions to CF types.
Swift SVN r19643
2014-07-07 22:42:11 +00:00
Dmitri Hrybenko
62c772ad6a stdlib: hide Objective-C bridging implementation details
Swift SVN r19595
2014-07-07 09:46:07 +00:00
Anna Zaks
c1537fdcdd Reject explicit uses of CFRetain/CFRelease/CFAutorelease
Ban use of CFRetain, CFRelease, CFAutorelease used for manual memory management as well as a bunch of other similar APIs, such as CGColorRelease.
Addresses radar://16892185

Swift SVN r19552
2014-07-04 02:29:05 +00:00
Doug Gregor
e6227bcc54 Remove XFAILs for 32-bit targets. This was part of <rdar://problem/17411843>
Swift SVN r19488
2014-07-02 23:13:50 +00:00
Joe Groff
c34b4f6a9e Enable string-to-pointer conversions and remove CString.
There is some follow-up work remaining:

- test/stdlib/UnicodeTrie test kills the type checker without manual type annotations. <rdar://problem/17539704>
- test/Sema/availability test raises a type error on 'a: String == nil', which we want, but probably not as a side effect of string-to-pointer conversions. I'll fix this next.

Swift SVN r19477
2014-07-02 19:15:10 +00:00
Chris Lattner
287059b360 implement <rdar://problem/17279286> Swift has too many Unicode escape sequence forms
This consolidates the \x, \u, and \U escape sequences into one \u{abc} escape sequence.
For now we still parse and cleanly reject the old forms with a nice error message, this
will eventually be removed in a later beta (tracked by rdar://17527814)


Swift SVN r19435
2014-07-01 23:27:44 +00:00
Joe Groff
7f3ad6af78 Back out a test change that's not ready yet.
Swift SVN r19377
2014-06-30 22:25:12 +00:00
Joe Groff
1b9a66e5d9 ClangImporter: Stop importing pointers as 'CString' when string-pointer conversions are enabled.
Swift SVN r19376
2014-06-30 22:22:01 +00:00
Dmitri Hrybenko
68c7a45c9b stdlib/printing: change Optional<T> representation in print to be Optional(...)
Because we are adding text to show internal representation, change the
conformance from Printable to DebugPrintable.

rdar://16950055


Swift SVN r19341
2014-06-30 15:23:51 +00:00
Joe Groff
47c0a7a473 Update array type syntax.
Swift SVN r19309
2014-06-27 22:17:51 +00:00
Joe Groff
7dfa7421d9 Restore array value semantics test for C pointer interop.
Bring back a part of this interpreter test that checked that passing a mutable pointer into an array preserves value semantics.

Swift SVN r19308
2014-06-27 22:15:52 +00:00
Joe Groff
cb48fbd24b Enable pointer conversions.
Swift SVN r19274
2014-06-26 23:26:31 +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
Ted Kremenek
a8259489cf Mark test 'CALayer.swift' as requiring OSX as it has APIs that are marked unavailable on iOS.
Swift SVN r19217
2014-06-26 04:25:51 +00:00
Doug Gregor
9210cd5ff4 Replace T[] array syntax with [T] in the test suite
Swift SVN r19192
2014-06-25 23:39:24 +00:00
Greg Parker
11f99d8b31 [test] Disable test objc_cast.swift on 32-bit pending rdar://17411843.
Swift SVN r19081
2014-06-22 19:27:53 +00:00
Doug Gregor
2b8923e3ef Allow "isa" patterns to downcast collections and bridge through Objective-C classes.
When checking an isa pattern that requires either collection
downcasting or bridging through an Objective-C class (e.g., 
"is String" or "is Dictionary<String, Int>"), form a conditional
downcast and place it in an expression pattern.

With this change, we can test for these cases (with "is") but we can't
capture the value produced on success (e.g., for "let str as
String"). This is a first small step toward <rdar://problem/17408934>.


Swift SVN r19070
2014-06-21 22:46:15 +00:00
Doug Gregor
c094309d70 Add a runtime test for a failed conditional, bridged binding.
Swift SVN r19066
2014-06-21 13:32:00 +00:00
Doug Gregor
37e242cc90 Rework handling of optionals for bridging forced and conditional downcasts.
Previously, we were unable to handle bridged downcasts to optional
types from optional sources, because because we applied the bridging
operation after we had already evaluated all of the bound optionals
(causing a crash). Now, we perform the bridging immediately after the
underlying forced or conditional cast, before evaluating the outer
bound optionals.

This also eliminates a bunch of code duplication between the forced
and conditional downcasts, now that the bridging code is shared.



Swift SVN r19065
2014-06-21 13:30:50 +00:00