Commit Graph

885 Commits

Author SHA1 Message Date
Max Moiseev
02006f20bc Merge remote-tracking branch 'origin/master' into swift-3-api-guidelines 2016-03-09 16:05:03 -08:00
Doug Gregor
3fb06d7442 [Swift runtime] Deallocation of partial class instances for Objective-C-derived classes.
Teach swift_deallocPartialClassInstance how to deal with classes that
have pure Objective-C classes in their hierarchy. In such cases, we
need to make sure a few things happen:

1) We deallocate via objc_release rather than
swift_deallocClassInstance.
2) We only attempt to find an execute ivar destroyers for
Swift-defined classes in the hierarchy
3) When we hit the most-derived pure Objective-C class, make sure that we
only execute the dealloc of that class and not any of the subclasses
(which would end up trying to destroy ivars again).

Fixes rdar://problem/25023544.
2016-03-08 16:47:57 -08:00
David Farler
e958f99acf Revert "Mangle declared interface type into NominalTypeDescriptor's Name"
This reverts commit 2262bd579a.

This information isn't necessary for field descriptor lookup,
after all. It's only the fields that need to have generic information,
which is already in the field descriptor.
2016-03-03 12:55:35 -08:00
David Farler
2262bd579a Mangle declared interface type into NominalTypeDescriptor's Name
Previously, the mangling didn't include generics, but these are
needed to key off of the new field descriptor metadata, as well
as to construct type references for the nominal type.
2016-03-03 12:14:38 -08:00
Max Moiseev
859db53d87 Merge remote-tracking branch 'origin/master' into swift-3-api-guidelines 2016-03-01 12:56:26 -08:00
Joe Groff
a4fa786a6f Handle a parameter to property behaviors.
For prototyping purposes, we only support a single trailing closure parameter to begin with.
2016-03-01 11:51:25 -08:00
Kevin Ballard
c08440394a [SILGen] Handle #function in defer blocks correctly
Using `#function` in a `defer` block should return the enclosing
function name rather than the string `$defer()`.

Fixes SR-819.
2016-02-29 15:06:11 -08:00
Max Moiseev
e48f452a2e Merge remote-tracking branch 'origin/swift-3-api-guidelines' into swift-3-api-guidelines 2016-02-29 12:15:33 -08:00
Max Moiseev
a49dab6bf8 Merge remote-tracking branch 'origin/master' into swift-3-api-guidelines 2016-02-29 12:08:52 -08:00
Michael Gottesman
8eed9f15b8 Disable two interpreter tests that fail when run with optimizations until they are looked at.
rdar://24874073
2016-02-27 02:35:17 -08:00
Daniel Duan
2bc78b8c09 [stdlib] update for 'inout' adjustment (SE-0031) 2016-02-26 12:02:29 -08:00
Joe Groff
48b643c6af Property behaviors: Iterate prototype syntax to try a postfix form.
If behaviors are specified after the declaration, something like this:

  ```swift
  var x: Int __behavior foo // __behavior is a stand-in keyword
  ```

we're thinking this encourages a simpler design for smaller, more composable behaviors. If we think of behavior application as function-like, then parameters to the behavior could be passed with function-like syntax:

  ```swift
  __behavior lazy(@autoclosure initialValue: () -> Value) { ... }

  var x: Int __behavior lazy(1738)

  __behavior didSet(body: (oldValue: Value) -> Void) { ... }

  var x: Int __behavior didSet {
    trailingClosure()
  }
  ```

Since behaviors are implementation details, they arguably belong to the right of the declaration as well.
2016-02-25 15:49:27 -08:00
Jordan Rose
b319e3da32 stdlib: Adjust to insert(contentsOf:at:) and append(contentsOf:)
instead of insertContents(of:at:) and appendContents(of:),
originally insertContentsOf(_:at:) and appendContentsOf(_:)
per internal discussion.
2016-02-25 12:50:39 -08:00
Slava Pestov
5c6d986b50 SILGen: When emitting a partial application thunk for a dynamic method, convert @autoreleased result to @owned
In IRGen, @autoreleased return values are always converted to +1 by
calling objc_retainAutoreleasedReturnValue(), so a partial application
thunk cannot have a result with @autoreleased convention. Just turn
it into @owned instead, since that's what it is, using similar logic
as the @unowned_inner_pointer => @unowned case.

Fixes <rdar://problem/24805609>.
2016-02-25 12:09:11 -08:00
Jordan Rose
e4e9c71d8f StdlibUnittest: Rename enum cases and static vars to match API guidelines. 2016-02-24 18:23:59 -08:00
Jordan Rose
f922084180 stdlib: Rename miscellaneous enum cases and static vars. 2016-02-24 17:46:14 -08:00
Max Moiseev
0490e86d01 [stdlib] strideTo/strideThrough => stride(to:...)/stride(through:...) 2016-02-24 09:56:10 -08:00
Dmitri Gribenko
f0633ce5a9 stdlib: Sequence.iterator() => .makeIterator() 2016-02-23 13:52:30 -08:00
Max Moiseev
52f0cf49b0 [stdlib] indexOf => index(of:)/index(where:) 2016-02-23 11:45:11 -08:00
Dmitri Gribenko
196188b9c8 stdlib: add 'to:' label to dump() 2016-02-22 18:16:38 -08:00
Max Moiseev
4b9eab6288 appendContentsOf => appendContents(of:) 2016-02-22 18:02:04 -08:00
Joe Groff
e99961eb8f AST: Fix Substitution::subst to substitute associated types from conformance witnesses instead of by name.
Fixes a crash when property behavior uses are run through the specializer, since they set up associated type conformances that are not recoverable by name lookup.
2016-02-22 15:31:14 -08:00
Joe Groff
f21a1093f9 Disable test/Interpreter/property_behavior.swift optimized execution tests.
The specializer needs to be updated to resolve associated types by protocol conformance witness rather than name lookup.
2016-02-22 13:21:37 -08:00
Max Moiseev
fcad164e18 Merge remote-tracking branch 'origin/master' into swift-3-api-guidelines 2016-02-22 12:59:57 -08:00
Joe Groff
c6bfac7281 Handle initial value requirements in property behaviors.
If a behavior protocol requires an `initialValue` static property, satisfy the requirement using the initial value expression from the property declaration. This lets us implement `lazy` as a property behavior.
2016-02-22 08:43:17 -08:00
Joe Groff
d4fdc1e7a8 Conditionally enable behaviors by a frontend flag.
Since the feature is incomplete and yet to be accepted or implemented as proposed, hide it behind an -enable-experimental-property-behaviors frontend flag.
2016-02-20 15:01:06 -08:00
Joe Groff
89a0578eae Add an interpreter test for "delayed" property behavior.
We have enough implementation to do "delayed" now.
2016-02-20 15:01:06 -08:00
Max Moiseev
40b1a0b7e0 [stdlib] all sorts of require renamed back to precondition 2016-02-19 18:21:29 -08:00
Dmitri Gribenko
b1ef18fb75 stdlib: lowercase cases of AncestorRepresentation and DisplayStyle enums 2016-02-19 16:06:26 -08:00
Dmitri Gribenko
0f36bec31f Merge remote-tracking branch 'origin/master' into swift-3-api-guidelines 2016-02-18 16:41:35 -08:00
Dmitri Gribenko
65d840c0ae stdlib: lowercase cases in Optional and ImplicitlyUnwrappedOptional 2016-02-18 00:40:33 -08:00
Dmitri Gribenko
dd75aed67a Merge remote-tracking branch 'origin/master' into swift-3-api-guidelines 2016-02-17 14:40:05 -08:00
Saleem Abdulrasool
cc02a0b5c6 test: remove ulimit -c unlimited
The core limit adjustment was added in SVN r17964 (fad87470) by Ted Kremenek.
This is problematic in bash where if a `ulimit -c 0` was invoked prior to the
test running, it would fail due to the failure to set the core limit to
unlimited.  Interestingly enough, this will be different across bash and zsh.
2016-02-17 14:28:24 -08:00
Dmitri Gribenko
efaa39ea79 stdlib: add first argument labels and some other changes to conform to API guidelines 2016-02-15 23:47:54 -08:00
Max Moiseev
3a3984877a Merge remote-tracking branch 'origin/master' into swift-3-api-guidelines 2016-02-15 15:43:34 -08:00
practicalswift
9eb2ee0638 [gardening] Fix accidental double spaces 2016-02-14 17:30:44 +01:00
Slava Pestov
90a172e63b IRGen: Always use swift_initClassMetadata_UniversalStrategy() even if the class does not have generically-sized fields
This function points the ivar offsets at per-metadata field offsets
before passing off the class to the Objective-C runtime, ensuring
we don't slide the global ivar offsets multiple times.

The swift_initializeSuperclass() function does not do this ivar
cloning, so it cannot be used for generic classes even if they do
not have generically-sized fields.

An alternative would be to refactor the runtime to clone ivar offset
vectors in swift_initializeSuperclass(), but this doesn't seem to be
worth it for now.
2016-02-11 23:23:26 -08:00
Max Moiseev
55fde4c923 making tests pass 2016-02-10 16:08:40 -08:00
Max Moiseev
61c837209b Merge remote-tracking branch 'origin/master' into swift-3-api-guidelines 2016-02-04 16:13:39 -08:00
Chris Lattner
92750511df Convert the last uses of __FILE__ etc in the testsuite over to the new
syntax.  I left the tests for the deprecation warnings in
test/expr/expressions.swift.
2016-02-04 15:41:09 -08:00
Dmitri Gribenko
5c9214329d Annotate tests as executable 2016-02-04 09:42:26 -08:00
David Farler
8a5ed405bf Make var parameters an error for Swift 3
This finishes up revisions to SE-0003 - only var function parameters
are disallowed for Swift 3.
2016-01-30 12:39:17 -08:00
David Farler
3f635d04c7 Reinstante var bindings in refutable patterns, except function parameters.
This reverts commits: b96e06da44,
                      8f2fbdc93a,
                      93b6962478,
                      64024118f4,
                      a759ca9141,
                      3434f9642b,
                      9f33429891,
                      47c043e8a6.

This commit leaves 'var' on function parameters as a warning to be
merged into Swift 2.2. For Swift 3, this will be an error, to be
converted in a follow-up.
2016-01-29 15:27:08 -08:00
Slava Pestov
5a53ac6078 Better tests for _typeByName()
These catch a regression I introduced with my previous patch that I reverted:

<65dd0e7b93>
2016-01-29 00:05:10 -08:00
Austin Zheng
77918a86ac [SR-88] Reinstate Mirror migration changes, fix test issues
This reverts commit 182bb7f812.
2016-01-27 20:40:52 -08:00
Doug Gregor
f7407f6a4d [SILGen] SE-0022: emit SIL for #selector expressions.
This completes the core of the #selector feature, which can now be
used to reference the selectors of @objc methods and initializers.
2016-01-27 13:57:40 -08:00
Andrew Trick
182bb7f812 Revert "Merge pull request #1058 from austinzheng/az-port-mirror"
This pull request broke the following tests on several build configurations
(eg --preset=buildbot,tools=RA,stdlib=DA)

    1_stdlib/Reflection.swift
    1_stdlib/ReflectionHashing.swift
    1_stdlib/UnsafePointer.swift.gyb

This reverts commit c223a3bf06, reversing
changes made to 5c2bb09b09.
2016-01-27 10:43:08 -08:00
Austin Zheng
10d5b23c30 [SR-88] Reinstate mirror migration commit
Changes:
- Reverted commit reverting original SR-88 commit
- Removed mirror children helper collections and related code
- Rewrote some tests to keep them working properly
- Wrote two more tests for the three pointer APIs to ensure no crashes if created using a value > Int64.max

This reverts commit 8917eb0e5a.
2016-01-26 19:28:32 -08:00
Brian Gesiak
2eb028b5ce [test] Mark tests unsupported on all Linux flavors
Autolinking was added to the frontend in 22912bc3b. It was disabled on
Linux in 198402dcf, and further constrained to be disabled on "linux-gnu"
in 83b4384fa. Since then, more flavors of Linux have become supported
by Swift: "linux-gnueabihf" in 4bf81e09d, and "freebsd" in f41b791d4.

Autolinking most likely does not work on any of these platforms, so
mark it as unsupported for now.

Other tests that only mark "linux-gnu" as unsupported do so for similar
reasons. Ensure unsupported tests for "linux-gnu" are also unsupported
on similar platforms.
2016-01-25 11:57:14 -05:00
Slava Pestov
ac5f44e913 SILGen: Fix materializeForSet for observing accessors
The following patch introduced a regression where materializeForSet
did not invoke didSet/willSet for stored properties with observers:

<249242b08d>

The old SILGen materializeForSet was only used for witness thunks,
where it used Ordinary access semantics for the storage.

When I switched over to using the new materializeForSet implementation
for static thunks too, I added some logic to use DirectToStorage access
semantics where appropriate, however this was wrong for observable
properties, which need DirectToAccessor semantics.

Fixes <rdar://problem/24315392>.
2016-01-23 23:39:30 -08:00