Commit Graph

37517 Commits

Author SHA1 Message Date
Dmitri Gribenko
09f7245dbf stdlib: add SWIFT_RUNTIME_STDLIB_INTERFACE attribute where necessary
... and remove some redundant ones.

This change fixes the RuntimeObjC.swift test.

rdar://problem/26239602
2016-05-12 15:48:25 -07:00
swift-ci
6105438ae3 Merge pull request #2498 from swiftix/master 2016-05-12 13:14:55 -07:00
Roman Levenstein
1494d155c6 Don't sink open_existential instructions.
We don't sink open_existential_* instructions, because there may be some instructions depending on them, e.g. ametatype_inst, etc. But this kind of dependency cannot be expressed in SIL as a use yet. As a result, sinking open_existential may break the invariant that these instructions should dominate their uses.
2016-05-12 12:05:49 -07:00
Roman Levenstein
2eff3a1e9b Do not hoist metatype instructions with opened existentials.
Hoisting this instructions may break the invariant that each such instruction should be dominated by an open_existential instruction.
2016-05-12 12:05:20 -07:00
Michael Ilseman
22ddf81047 [CG Import as Member] Fix argument label swap 2016-05-12 11:59:36 -07:00
Michael Gottesman
bc90c3b5d4 Do not run the backtrace test when running tests with optimizations enabled.
We do not emit backtraces when optimization is enabled. We could do a negative
test here but I do not think it really adds much.
2016-05-12 10:42:57 -07:00
Michael Ilseman
633d968c90 [Import as Member] Remove broken swift_name for CGPDFPageGetBoxRect 2016-05-12 10:18:08 -07:00
Erik Eckstein
db288e958b SimplifyCFG: fix a crash in debug output 2016-05-12 08:38:38 -07:00
Andrew Trick
bc70c7e92c Merge pull request #2484 from atrick/specialize
Add unit tests for subscript specialization.
2016-05-12 08:28:45 -07:00
Slava Pestov
6196ad4e0b SIL: Teach SILVerifier::isLoweringOf() about DynamicSelfType
The concrete type of an existential might involve dynamic Self
in some cases.

Fixes <rdar://problem/22003864>.
2016-05-11 23:43:31 -07:00
Dmitri Gribenko
a2c50f55ee Revert "Revert "Temporarily comment out some runtime tests due to linker failure.""
This reverts commit 94f6bbb4b3.

It broke again:

https://ci.swift.org/job/oss-swift_tools-RA_stdlib-RDA_test-simulator/1271/
https://ci.swift.org/job/oss-swift_tools-RA_stdlib-RD_test-simulator/1349/
2016-05-11 23:33:14 -07:00
Doug Gregor
3650ce8ecd SE-0064 / SR-1239: Fix-Its for string-literal selectors naming property accessors.
When we see a string literal used to initializer a Selector, and that
string literal names the selector for the getter or setter of an
Objective-C property, suggest #selector(getter: ...) or

This completes SE-0064. Big thanks for Alex Hoppen (@ahoppen) for his
contributions here.
2016-05-11 23:03:37 -07:00
Alex Hoppen
a0a74aeb46 SE-0064 / SR-1239: Code completion for #selector of property getters/setters.
Implement basic code completion support for #selector with property
getters/setters. The vast majority of this implementation comes from
Alex Hoppen (@ahoppen), with only a handful of my own tweaks. Alex has
more interesting ideas on improving this that I wasn't quite ready to
commit to, so this is more basic than the overall goal.
2016-05-11 23:03:37 -07:00
Slava Pestov
cc0fcc56bf Add test case for rdar://21770225, which seems to have been fixed
I think John fixed this as part of the recent runtime and IRGen
work toward lazier metadata accesses.
2016-05-11 22:51:33 -07:00
Slava Pestov
ce0b51cc9b Update resilience annotations in stdlib for recent changes
The new indexing model and floating point stuff was missing a few
annotations, causing a build failure with -enable-resilience.
2016-05-11 22:51:33 -07:00
Slava Pestov
85a75524d5 Reflection: Clearer metadata offset calculations, NFC 2016-05-11 22:51:32 -07:00
Slava Pestov
c552b3c614 Sema: Remove unnecessary cast that leading to crash when subscript witness was mislabeled
Fixes <rdar://problem/22981205>.
2016-05-11 22:51:32 -07:00
Slava Pestov
3bc64f37b8 Sema: Re-purpose unavailable override checking code for protocol conformances
This was easy with a bit of refactoring, but eventually I'd love to
converge override checking and witness checking logic a bit more.

Fixes <rdar://26183366>.
2016-05-11 22:51:32 -07:00
swift-ci
954ea0eb99 Merge pull request #2488 from compnerd/return-type 2016-05-11 22:36:29 -07:00
swiftix
4eaed25a5e Merge pull request #2491 from swiftix/devirtualizer-fixes
Small fixes for the sil-devirtualizer
2016-05-11 21:35:46 -07:00
Joe Groff
04d5a6a19f Merge pull request #2487 from jckarter/r26210805
SILGen: Partial applications of methods don't lie about their nonnull-ness.
2016-05-11 21:04:14 -07:00
swift-ci
ebd20fb790 Merge pull request #2493 from rudkx/callee-analysis 2016-05-11 20:27:40 -07:00
Stephen Canon
878134b1d5 Merge branch 'stephentyrone-SE-0067'
Implements almost all of SE-0067. There are a few outstanding features; this implementation does not have:

- formRemainder(dividingBy:)
- formSquareRoot()
- addProduct(_:,_:)

Additionally, the basic operators are still present on the concrete types; it is not possible to remove them without changes to either overload resolution or the Strideable protocol, both of which are out of scope for this change.  They will be removed once it is possible for that to be done.
2016-05-11 22:12:20 -04:00
Stephen Canon
772d7ec3c5 Merge branch 'SE-0067' of https://github.com/stephentyrone/swift into stephentyrone-SE-0067
Implements almost all of SE-0067. There are a few outstanding features; this implementation does not have:

- formRemainder(dividingBy:)
- formSquareRoot()
- addProduct(_:,_:)

which require additions to the Builtin module. I can probably figure out how to do these, but I haven't had a chance to do so yet. Also missing are the generic initializers and comparisons whose implementation depends on having new Integer protocols.

The last remaining feature of SE-0067 is that while the basic operators +,-,*,/, etc are moved onto the FloatingPoint protocol, they are still required on the concrete types in order to disambiguate overloads. Fixing this seems to require either modifying the overload resolution rules or removing these operators from some other protocols. Or it might just require that someone smarter than me looks at the problem.

Passes the existing tests locally (with the included changes). I'm working on additional tests for the new features.
2016-05-11 22:11:21 -04:00
swift-ci
df4d93901f Merge pull request #2490 from kballard/flatten-seealso-joinWithSeparator 2016-05-11 18:10:56 -07:00
Jordan Rose
d72d0942fe Handle renaming for "unavailable in Swift" decls.
...like the "Ref" forms of imported CF types.

rdar://problem/25883961
2016-05-11 17:29:16 -07:00
Michael Gottesman
8308ad85e2 Merge pull request #2485 from gottesmm/change-backtrace-to-use-dladdr-directly-instead-of-backtrace_symbol
When producing backtraces, do not use backtrace_symbol, invoke dladdr…
2016-05-11 17:28:36 -07:00
Max Moiseev
4027afa536 [stdlib] fixing the signature of RandomAccessCollection.index(_:offsetBy:limitedBy:) and uncommenting the test 2016-05-11 17:27:49 -07:00
Mark Lacey
921dededad Use a bump pointer allocator in the callee set creation.
Shaves about 19% of the time from the construction of these sets. The
SmallVector size was chosen to minimize the number of dynamic
allocations we end up doing while building the stdlib. This should be a
reasonable size for most projects, too. It's a bit wasteful in space,
but the total amount of allocated space here is pretty small to begin
with.
2016-05-11 17:07:27 -07:00
Alex Hoppen
d2e045c8b5 Implement SE-0064 / SR-1239: #selector for property getters and setters
Implements the core functionality of SE-0064 / SR-1239, which
introduces support for accessing the Objective-C selectors of the
getter and setter of an @objc property via #selector(getter:
propertyName) and #selector(setter: propertyName).

Introduce a bunch of QoI around mistakes using #selector to refer to a
property without the "getter:" or "setter:", using Fix-Its to help the
user get it right. There is more to do in this area, still, but we
have an end-to-end feature working.

Much of the implementation and nearly all of the test cases are from
Alex Hoppen (@ahoppen). I've done a bit of refactoring, simplified the
AST representation, and replaced Alex's custom
expression-to-declaration logic with an extension to the constraint
solver. The last bit might be short-lived, based on swift-evolution
PR280, which narrows the syntax of #selector considerably.
2016-05-11 16:51:27 -07:00
Roman Levenstein
73b6a38edc [sil-devirtualizer] Do not perform a speculative devirtualization for no-opt callees. 2016-05-11 16:28:50 -07:00
Dmitri Gribenko
0556c4b387 Merge pull request #2480 from compnerd/attribute-spelling
stdlib: use the reserved attribute spellings
2016-05-11 16:28:17 -07:00
swift-ci
b56c15a08e Merge pull request #2461 from russbishop/fork/master 2016-05-11 16:20:42 -07:00
Jordan Rose
670f7b5b6d Optionals of imported value types are not @objc.
While we could bridge 'NSRange' to 'NSRange' and 'NSRange?' to
'NSValue * _Nullable', that (a) would be confusing, and (b) isn't
actually implemented at the moment. Fix my mistake in 477933b to
start accepting these.
2016-05-11 16:18:24 -07:00
John McCall
e75dae491e Don't diagnose failures to call symmetrically-typed binary operators
as a failure to convert the individual operand, since the operator
is likely conceptually generic in some way and the choice of any
specific overload is probably arbitrary.

Since we now fall back to a better-informed diagnostics point, take
advantage of this to generate a specialized diagnostic when trying to
compare values of function type with ===.

Fixes rdar://25666129.

This reverts commit 073f427942,
i.e. it reapplies 35ba809fd0 with a
test fix to expect an extra note in one place.
2016-05-11 16:09:28 -07:00
Kevin Ballard
83c113c11e [Stdlib] Update the SeeAlso docs for flatten()
flatten() was still referencing `joinWithSeparator(_:)` even though
that's now been renamed to `joined(separator:)`.
2016-05-11 16:01:41 -07:00
Ted Kremenek
073f427942 Revert "Don't diagnose failures to call symmetrically-typed binary operators"
This reverts commit 35ba809fd0.
2016-05-11 15:53:24 -07:00
Michael Gottesman
7523d1a60b When producing backtraces, do not use backtrace_symbol, invoke dladdr directly.
Previously, we were using backtrace_symbol and then parsing/modifying its
output. By just using dladdr directly, we have a cleaner and more robust
solution.

rdar://25064742
2016-05-11 15:40:10 -07:00
Roman Levenstein
28f7b09c1d Add a more strict check for conversions between metatypes.
Now it is more inline with the check performed by the verifier.
2016-05-11 15:25:08 -07:00
Roman Levenstein
f200dfdc72 Addresses are always ABI compatible.
Now it is more inline with the check performed by the verifier.
2016-05-11 15:25:08 -07:00
John McCall
35ba809fd0 Don't diagnose failures to call symmetrically-typed binary operators
as a failure to convert the individual operand, since the operator
is likely conceptually generic in some way and the choice of any
specific overload is probably arbitrary.

Since we now fall back to a better-informed diagnostics point, take
advantage of this to generate a specialized diagnostic when trying to
compare values of function type with ===.

Fixes rdar://25666129.
2016-05-11 15:10:25 -07:00
Stephen Canon
71e7767346 Make sure @_transparent and @warn_unused_result are on operators where appropriate. 2016-05-11 18:08:23 -04:00
Jordan Rose
18c7592863 Add frontend option "-warn-long-function-bodies=<N>".
This is a /slightly/ more user-friendly option than
-debug-time-function-bodies; pass it a limit in milliseconds and
the compiler will warn whenever a function or multi-statement closure
takes longer than that to type-check.

Since it's a frontend option (and thus usually passed with -Xfrontend),
I went with the "joined" syntax as the common case. The usual "separate"
syntax of "-warn-long-function-bodies <N>" is also available.

As a frontend option, this is UNSUPPORTED and may be removed without
notice at any future date.

Additional caveats:
- Other parts of type-checking not measured by this may also be slow.
- May include first-use penalties (i.e. "this is slow because it's
  the first function that references an imported type, which causes
  many things to be imported")
- Does not report anything whatsoever about other phases of compilation
  (SILGen, optimization, IRGen, assembly emission, whatever).
- Does not catch anything accidentally being type-checked multiple times
  (a known issue for initial value expressions on properties).
2016-05-11 15:08:17 -07:00
Saleem Abdulrasool
a0602badff IRGen: mark the end point at unreachable
warning: control may reach end of non-void function [-Wreturn-type]

Add a llvm_unreachable to indicate that the function will always return or fail
more obviously rather than returning a garbage value.
2016-05-11 15:05:25 -07:00
swift-ci
ecd882168f Merge pull request #2482 from apple/reenable-runtime-objc-test 2016-05-11 14:40:52 -07:00
Joe Groff
3ce22b8955 SILGen: Partial applications of methods don't lie about their nonnull-ness.
Fixes rdar://problem/26210805.
2016-05-11 14:37:09 -07:00
swift-ci
274ff905c5 Merge pull request #2481 from apple/coregraphics-cgfloat-from-cgfloat 2016-05-11 14:16:19 -07:00
Argyrios Kyrtzidis
6b8ee42248 [fixcode] Accept the fixit for adding bang to unwrap optional.
This is useful for getting fixits for the IOU handling changes.
2016-05-11 13:58:24 -07:00
swift-ci
273ad53dce Merge pull request #2478 from compnerd/storage-annotation 2016-05-11 13:58:05 -07:00
Russ Bishop
7dc71d0d96 Rename generic arguments 2016-05-11 13:44:37 -07:00