Commit Graph

2588 Commits

Author SHA1 Message Date
Arnold Schwaighofer
de66079e18 Mark some executable_tests as such 2018-01-19 12:58:41 -08:00
swift-ci
30589121e6 Merge pull request #13960 from kubamracek/fix-objc-runtime-visible-test 2018-01-18 16:47:15 -08:00
Slava Pestov
f5f715f8ff SILGen: Support multiple-entry case blocks with address-only bindings
Fixes <rdar://problem/30870493>, <https://bugs.swift.org/browse/SR-4163>.
2018-01-17 21:02:08 -08:00
Mark Lacey
41056ae3a4 Add runtime tests for bridging optionals and IUOs. 2018-01-16 23:12:28 -08:00
Kuba Mracek
8b0ae9e651 Fix the temp-objc_runtime_visible.swift to work with when building swift against a non-default toolchain 2018-01-15 15:51:42 -08:00
Arnold Schwaighofer
4cd16ae489 IRGen: Empty fields do have an entry in the field offset vector
This is an error introduced as the result of a refactoring a while ago
and means that we will store dependently typed stored properties at the
wrong offset in a generic struct if it has stored properties of empty
types before said property.

rdar://36384871
2018-01-12 13:00:13 -08:00
Jordan Rose
18689fe223 [Mangling] Uniformly use "So" for imported decls.
...and repurpose "SC" for (C)lang-importer-synthesized decls, instead
of just decls that are C-like instead of ObjC-like. (See next commits.)
2018-01-09 17:55:23 -08:00
Slava Pestov
9de7b86bb0 Enable part of class_resilience test that works now 2018-01-03 19:30:30 -08:00
Slava Pestov
8024b81594 IRGen: Preliminary implementation of resilient method overrides
This is not the final mechanism, because it does not allow
re-ordering superclass methods, but at least it works if
you don't do that.
2018-01-03 19:30:30 -08:00
Slava Pestov
d1c4a5aec4 Merge pull request #13592 from slavapestov/fix-really-bad-witness-method-bug
IRGen: Fix runtime crash with default implementation of protocol requirement with a generic class
2017-12-21 22:54:58 -08:00
Slava Pestov
7401aa607f IRGen: Fix runtime crash with default implementation of protocol requirement with a generic class
If the 'self' type is abstract, we still have to consider it as
a source of type metadata, because it might be a class-bound
generic parameter and the class might have generic parameters.

Fixes <rdar://problem/36093833>.
2017-12-21 17:28:52 -08:00
Devin Coughlin
51f835ed01 [Exclusivity] Additional tests for static and dynamic exclusivity.
Add more exclusivity tests. This includes a test for a known false
negative involving keypaths for class properties.

This is a test-only change.
2017-12-21 15:13:10 -08:00
Arnold Schwaighofer
fb9696f427 IRGen: Fix mismatching sret attribute for indirect return values
We incorrectly lowered callsites when we had sil function return types
that involved both direct return types that we decide to lower
indirectly,  and indirect return types.

@convention(thin) () -> (@owned String, @owned String, @owned String, @out Any, @out Any)

(This should have been handled by the address lowering pass but isn't)

rdar://35874410
2017-12-19 18:58:53 -08:00
Doug Gregor
b85be28611 [Runtime] Print demangled names in conditional conformances warning. 2017-12-19 10:30:00 -08:00
Doug Gregor
ffb0d55b35 Eliminate extraneous uses of -enable-experimental-conditional-conformances 2017-12-18 22:56:22 -08:00
Doug Gregor
5c831a71ee Revert "[SE-0143] Put conditional conformances behind an "experimental" flag."
This reverts commit b59c30c1af.
2017-12-18 22:54:31 -08:00
Doug Gregor
7f09b36015 [Runtime] Warn about dynamically querying conditional conformances.
Rather than silently returning "false" when we are unable to attempt
to satisfy a conditional conformance at runtime, produce a runtime
warning first, to note to users that this behavior is incorrect and
will change in the future.
2017-12-18 22:52:39 -08:00
Doug Gregor
31723be232 Merge pull request #13264 from DougGregor/se-0143-better-fail-than-crash
[Runtime] Always fail to find a conditional conformance at runtime.
2017-12-04 21:50:25 -08:00
Doug Gregor
4f8edeb913 [Runtime] Always fail to find a conditional conformance at runtime.
Proper evaluation of conditional conformances at runtime (e.g., as part of
dynamic casting) is too large to tackle in the Swift 4.1 timeframe. For now,
record that a conformance is conditional in the protocol conformance record,
and always return "does not conform" to such types.

Fixes rdar://problem/35761301.
2017-12-04 16:51:52 -08:00
Pavel Yaskevich
6ca3d3fc72 Merge pull request #13138 from xedin/rdar-35702810
[CSSolver/SILGen] Fix solver to support function conversion with collection subtyping
2017-12-04 15:05:37 -08:00
Pavel Yaskevich
515520e524 [CSSolver/SILGen] Fix solver to support function conversion with collection subtyping
Fix collection subtyping relation in function argument position
by emiting special re-abstraction thunk with collection upcast.

Resolves: rdar://problem/35702810
2017-11-30 16:47:18 -08:00
Ben Cohen
dcab9493ae Removed some warnings (#12753) 2017-11-30 15:12:56 -08:00
Joe Groff
fb2fc93cbf IRGen: Followup fixes for handling subclasses of mixed-mode classes with missing ivars.
Following up on the fixes for rdar://problem/35330067. If a class inherits a class from another module with missing fields, we need to treat its size and alignment as opaque, just like the base class itself. We also need to lay out such  class at runtime, since we don't know the size, alignment, or field offsets at compile time; relying on the ObjC runtime alone will slide the ivar offsets, but not the Swift instance size and alignment. Fixes rdar://problem/35747485.
2017-11-29 19:21:36 -08:00
Arnold Schwaighofer
66d0daadff mixed_mode_class_with_missing_properties.swift: This test fails on i386 with an unoptimized stdlib
XFAIL it to unblock bots.

rdar://35747485
2017-11-29 10:22:45 -08:00
Arnold Schwaighofer
7a5a1e4535 Change test case to use LifetimeTracked as per review request 2017-11-28 20:01:00 -08:00
Arnold Schwaighofer
54f10c17d6 Merge pull request #13121 from aschwaighofer/fix_closure_capture_leak
IRGen: Indirect_In_Constant inside of partial apply forwarders is now…
2017-11-28 19:00:40 -08:00
swift-ci
cdab55a202 Merge pull request #13124 from DougGregor/se-0143-experimental-flag 2017-11-28 16:59:27 -08:00
Doug Gregor
b59c30c1af [SE-0143] Put conditional conformances behind an "experimental" flag.
Conditional conformances aren't quite ready yet for Swift 4.1, so
introduce the flag `-enable-experimental-conditional-conformances` to
enable conditional conformaces, and an error when one declares a
conditional conformance without specifying the flag.

Add this flag when building the standard library (which will vend
conditional conformances) and to all of the tests that need it.

Fixes rdar://problem/35728337.
2017-11-28 16:01:51 -08:00
Jordan Rose
5096801d7c Merge pull request #13114 from jrose-apple/host-with-the-most
Accept that swiftc should infer the running OS as the target
2017-11-28 15:48:47 -08:00
Arnold Schwaighofer
cac837548d IRGen: Indirect_In_Constant inside of partial apply forwarders is now assumed to be @guaranteed
Since closure captures are now @guaranteed. Previous to this fix we
assumed @owned which matched the old closure capture convention.

Neither version is proper of course:

The proper fix, I will follow up with, is that when the large loadable
types pass lowers @guaranteed/@owned to @indirect_in_constant it should
disambiguate to @indirect_in_constant_guaranteed/owned.

rdar://35674625
2017-11-28 15:18:17 -08:00
Jordan Rose
2818969c23 [test] Accept that swiftc should infer the running OS as the target
Specifically, this is about the /version/ of the running OS.
Previously, this was only autodetected for the interpreter, with the
compiler defaulting to the earliest version of macOS supported by
Swift (10.9); picking the current running OS seems more useful. LLVM
changed their default behavior recently, so this doesn't actually
require any implementation changes.

This only affects macOS today, because it only affects compiling
without an explicit target (i.e. not cross-compiling) on an OS with
cross-version binary compatibility (i.e. not Linux).

rdar://problem/29948658
2017-11-28 11:36:00 -08:00
Doug Gregor
5af0d814e8 Re-enable conditional conformances test in optimized build. 2017-11-28 10:43:15 -08:00
Doug Gregor
050fd9b0a4 Merge pull request #13032 from DougGregor/conditional-conformances-superclass
[AST] Properly adjust substitution type for inherited conformances.
2017-11-19 22:25:42 -08:00
Doug Gregor
8ad35e078a [SE-0143] Enable test for inherited conditional conformances.
Addressed by the previous work to use interface types in associated type
witnesses. Fixes rdar://problem/35480728.
2017-11-19 21:34:15 -08:00
ematejska
a00b0749c4 Merge pull request #12849 from rudkx/SE-0054
SE-0054: Rework diagnostics for IUOs and revise Swift 3 /4 semantics.
2017-11-18 18:51:39 -08:00
Mark Lacey
8b55a0f61b SE-0054: Rework diagnostics for IUOs and revise Swift 3 /4 semantics.
For Swift 3 / 4:

Deprecate the spelling "ImplicitlyUnwrappedOptional", emitting a warning
and suggesting "!" in places where they are allowed according to
SE-0054.

In places where SE-0054 disallowed IUOs but we continued to accept them
in previous compilers, emit a warning suggesting "Optional" or "?"  as
an alternative depending on context and treat the IUO as an Optional,
noting this in the diagnostic.

For Swift 5:

Treat "ImplicitlyUnwrappedOptional" as an error, suggesting
"!" in places where they are allowed by SE-0054.

In places where SE-0054 disallowed IUOs, emit an error suggestion
"Optional" or "?" as an alternative depending on context.
2017-11-18 11:41:53 +09:00
Joe Groff
39dfe07354 IRGen: Treat class layout for classes from other modules a bit more opaquely.
We would miscompile in mixed-language-version projects when a Swift class was compiled for one language version, while using Objective-C-imported types that are only available to that version, and then imported into a Swift module with a different language version that wasn't able to see all of the properties because of incompatible imported types. This manifested in a number of ways:

- We assumed we could re-derive the constant field offsets of the class's ivars from the layout, which is wrong if properties are missing, causing accesses to final properties or subclass properties to go to the wrong offsets.
- We assumed we could re-derive the instance size and alignment of a class instance in total, causing code to allocate the wrong amount of memory.
- We neglected to account for the space that stored properties take up in the field offset vector of the class object, causing us to load vtable entries for following subclass methods from the wrong offsets.

Eventually, resilience should reduce our exposure to these kinds of problems. As an incremental step in the right direction, when we look at a class from another module in IRGen, treat it as always variably-sized, so we don't try to hardcode offsets, size, or alignment of its instances. When we import a class, and we're unable to import a stored property, leave behind a new kind of MissingMemberDecl that records the number of field offset vector slots it will take up, so that we lay out subclass objects and compute vtable offsets correctly. Fixes rdar://problem/35330067.

A side effect of this is that the RemoteAST library is no longer able to provide fixed field offsets for class ivars. This doesn't appear to impact the lldb test suite, and they will ultimately need to use more abstract access patterns to get ivar offsets from resilient classes (if they aren't already), so I just removed the RemoteAST test cases that tested for class field offsets for now.
2017-11-17 14:38:08 -08:00
Erik Eckstein
76f281510f Remove @_semantics("optimize.sil.never")
The replacement is @_optimize(none)
2017-11-16 14:11:52 -08:00
Arnold Schwaighofer
e1700dee6e Disable conditional_conformances_smoke.swift in optimized mode
Fails on the bots.

rdar://35492657
2017-11-12 05:58:23 -08:00
Huon Wilson
5c0f158f88 [test] Fix conditional conformance tests for 32-bit platforms. 2017-11-10 19:22:03 -08:00
Huon Wilson
1372202cfa [test] More for conditional conformances; subclasses, devirtualization, etc. 2017-11-09 17:51:48 -08:00
Arnold Schwaighofer
7489bf717d runtime: Fix swift_deallocBox
We need to set the object into deallocating state (+1 -> +0).
2017-11-03 08:43:14 -07:00
Jordan Rose
85ccbb4990 [ClangImporter] Bridging can happen even without full bridgeability
Partially reverts f4f8349 (from July!) which caused us to start
importing global blocks with unbridged parameters, breaking source
compatibility. I'm still investigating whether there's an actual hole
in the logic; see next few commits.

rdar://problem/34913634
2017-11-02 14:40:39 -07:00
swift-ci
f1536bcc36 Merge pull request #12712 from compnerd/test-nullability 2017-11-02 10:36:50 -07:00
Saleem Abdulrasool
bdb7901a1c test: modernise nullability attributes (NFC)
Use the modern spelling for the nullability attributes in the test mock
headers.  Currently, this was relying on the predefined macros from
clang to work.  However, those are only available on Darwin targets.
This is needed to make the mock environments more portable.
2017-11-01 23:27:33 -07:00
Doug Gregor
77282a3e8a Merge pull request #12713 from DougGregor/remove-extensions-of-IUO
Remove extensions on ImplicitlyUnwrappedOptional from the stdlib.
2017-11-01 19:31:57 -07:00
Doug Gregor
2e2c7e8dd6 Update tests for removal of ImplicitlyUnwrappedOptional extensions. 2017-11-01 17:13:32 -07:00
Slava Pestov
4f1bda071f IRGen: Nested classes don't require runtime metadata instantiation
Fixes <rdar://problem/35221915>, <https://bugs.swift.org/browse/SR-6238>.
2017-11-01 15:58:23 -07:00
Arnold Schwaighofer
3947193578 Add a test case for the enum value witness fix 2017-11-01 10:54:53 -07:00
Slava Pestov
045c6496ff SILGen: Fix memory leak when calling constructor requirement of @objc protocol
Fixes <rdar://problem/30478887> / <https://bugs.swift.org/browse/SR-3935>.
2017-10-21 01:42:51 -07:00