Commit Graph

2588 Commits

Author SHA1 Message Date
Joe Groff
f49bc6c1d7 Correct availability for opaque type execution test.
Opaque types require the next Swift runtime.
2019-04-25 17:17:19 -07:00
Arnold Schwaighofer
50143048ee Initialize the extraInhabitantCount field of single case enums
rdar://49786768
2019-04-25 12:33:05 -07:00
Mike Ash
a3e5ac17b8 [Tests] XFAIL objc_class_resilience Category test on OS X 10.9.
rdar://problem/49794438
2019-04-25 15:31:00 -04:00
Arnold Schwaighofer
43a7b44577 Merge pull request #24201 from aschwaighofer/opaque_result_types_dyn_replacement_and_specialization
Opaque result types: dynamic replacement
2019-04-24 07:58:50 -07:00
Karoy Lorentey
ef20f69819 [test] bridged_casts_folding: Explicitly override optimization level to -Onone
Otherwise the unoptimized tests fail when the tests are run with optimizations enabled.
2019-04-23 15:18:43 -07:00
Doug Gregor
e29469b9c0 [Opaque result types] Fix mangling issues with opaque result types.
Fix a trio of issues involving mangling for opaque result types:
* Symbolic references to opaque type descriptors are not substitutions
* Mangle protocol extension contexts correctly
* Mangle generic arguments for opaque result types of generic functions

The (de-)serialization of generic parameter lists for opaque type
declarations is important for the last bullet, to ensure that the
mangling of generic arguments of opaque result types works across
module boundaries.

Fixes the rest of rdar://problem/50038754.
2019-04-22 17:10:45 -07:00
Arnold Schwaighofer
a0387eea40 Opaque result types: Dynamic replacement fixes for computed properties 2019-04-22 08:32:43 -07:00
Arnold Schwaighofer
f0a3b8be51 Fix tests 2019-04-22 07:48:00 -07:00
Arnold Schwaighofer
56f3949492 This test requires debug mode 2019-04-22 07:38:18 -07:00
Arnold Schwaighofer
84c7b77d02 Make opaque type descriptors dynamically replaceable
This is to support dynamic function replacement of functions with opaque
result type.

This approach requires that all state is thrown away (that could contain the
old returned type for an opaque type) between replacements.

rdar://48887938
2019-04-22 07:31:07 -07:00
Slava Pestov
7c8641c497 Fix formatting nit in objc_getClass test 2019-04-19 17:39:51 -04:00
Slava Pestov
9536eff2d6 Execution tests for Objective-C resilient class stubs
Fixes <rdar://49090613>, except they're disabled for the time being.
2019-04-19 17:39:51 -04:00
Slava Pestov
2fa1d03f53 Re-enable test/Interpreter/class_resilience.swift test 2019-04-19 16:50:29 -04:00
Joe Groff
7bab318238 Merge pull request #24159 from jckarter/protocol-extension-context-lookup
MetadataLookup: Use extension's generic context for non-nominal extensions.
2019-04-19 13:37:48 -07:00
Joe Groff
9a411bea6a MetadataLookup: Use extension's generic context for non-nominal extensions
In protocol extensions, and in the future parameterized extensions, have their own generic arguments
independent of an originating nominal type's formal generic parameters. Instead of crashing, handle
this gracefully. rdar://problem/50038754
2019-04-19 10:30:43 -07:00
swift-ci
fa43e3b9a1 Merge pull request #23185 from lorentey/in-memory-of-tubby-the-spaniel 2019-04-18 14:34:47 -07:00
Michael Gottesman
de021aa32b [cast-opt] Eliminate a leak along the cast failure path when bridging from a swift to ns object derived class.
I added an interpreter test that exercises this code path using LifetimeTracked
to make sure we do not regress again.

rdar://49882071
2019-04-13 20:10:24 -07:00
Harlan Haskins
150ad99457 [ModuleInterfaces] Replace 'module file' with 'compiled module'
...only in diagnostics. And make the tests pass.

rdar://49359734
2019-04-11 18:05:09 -07:00
Brent Royal-Gordon
7ae331dbca [NFC] Pick a few nits for Jordan 2019-04-10 23:17:04 -07:00
Brent Royal-Gordon
c37fee1719 Add parallel tests for static subscripts
This commit modifies various subscript-related test files to add static subscript equivalents of existing tests.
2019-04-10 23:17:04 -07:00
Arnold Schwaighofer
1b863d6787 Allow final on dynamic members
Dynamic is about dynamically replacing a method implementiation not
overriding.

rdar://49535048
2019-04-04 07:26:43 -07:00
Slava Pestov
e212d4567f Sema: Collect varargs into an ArrayExpr and use DefaultArgumentExpr
Instead of building ArgumentShuffleExprs, lets just build a TupleExpr,
with explicit representation of collected varargs and default
arguments.

This isn't quite as elegant as it should be, because when re-typechecking,
SanitizeExpr needs to restore the 'old' parameter list by stripping out
the nodes inserted by type checking. However that hackery is all isolated
in one place and will go away soon.

Note that there's a minor change the generated SIL. Caller default
arguments (#file, #line, etc) are no longer delayed and are instead
evaluated in their usual argument position. I don't believe this actually
results in an observable change in behavior, but if it turns out to be
a problem, we can pretty easily change it back to the old behavior with a
bit of extra work.
2019-03-31 01:36:19 -04:00
Karoy Lorentey
ae1bc7623c [test] bridged_casts_folding: make tests more resilient against changes in class cluster impl details 2019-03-28 14:32:06 -07:00
Karoy Lorentey
84bf144d3a [test] Update expected error message 2019-03-28 14:32:06 -07:00
Karoy Lorentey
a051b823b7 Revert "Revert "Reapply patch with test, but this time add a pizza unicode emoji to make sure we do not use tagged pointers" (#23180)"
This reverts commit 8d4aa2aa9a.
2019-03-28 14:32:06 -07:00
Slava Pestov
11d4fc0fbb SILGen: Clean up partially-initialized array elements when lowering ArrayExpr 2019-03-27 23:21:08 -04:00
Michael Gottesman
f854547c55 [ownership] Enable ownership verification by default.
I also removed the -verify-sil-ownership flag in favor of a disable flag
-disable-sil-ownership-verifier. I used this on only two tests that still need
work to get them to pass with ownership, but whose problems are well understood,
small corner cases. I am going to fix them in follow on commits. I detail them
below:

1. SILOptimizer/definite_init_inout_super_init.swift. This is a test case where
DI is supposed to error. The only problem is that we crash before we error since
the code emitting by SILGen to trigger this error does not pass ownership
invariants. I have spoken with JoeG about this and he suggested that I fix this
earlier in the compiler. Since we do not run the ownership verifier without
asserts enabled, this should not affect compiler users. Given that it has
triggered DI errors previously I think it is safe to disable ownership here.

2. PrintAsObjC/extensions.swift. In this case, the signature generated by type
lowering for one of the thunks here uses an unsafe +0 return value instead of
doing an autorelease return. The ownership checker rightly flags this leak. This
is going to require either an AST level change or a change to TypeLowering. I
think it is safe to turn this off since it is such a corner case that it was
found by a test that has nothing to do with it.

rdar://43398898
2019-03-25 00:11:52 -07:00
Michael Gottesman
6a7b7adc78 Merge pull request #23478 from gottesmm/pr-02277b9b2dc67311306e31d9429a74a956e3fadf
When emitting no-escape closures, make sure that we copy the closure …
2019-03-22 11:35:07 -07:00
Michael Gottesman
7246806ef6 When emitting no-escape closures, make sure that we copy the closure before we pass it into the partial apply to eliminate an ownership violation.
The problem here is that without this patch we emit code like this:

bb0(%0 : @owned $T):
  %1 = partial_apply %foo(%0)
  %2 = mark_dependence %1 on %0

Since a partial_apply consumes the object, the mark_dependence is a use after
free (especially if one has any further uses of %0 after the mark_dependence).
So what I did was I copied the value before creating the partial_apply. So
now we get this:

bb0(%0 : @owned $T):
  %1 = copy_value %0
  %2 = partial_apply %foo(%1)
  %3 = mark_dependence %2 on %0
  ...
  destroy_value %0

This ensures that one can actually have uses after the mark_dependence of both
operands.

This enables ownership verification to be enabled on
Interpreter/enforce_exclusive_access.

rdar://48521061
2019-03-21 19:39:51 -07:00
Arnold Schwaighofer
252738af5b Fix test case 2019-03-21 13:50:53 -07:00
Arnold Schwaighofer
e113ef8c93 Add a mode to test implicit dynamic with private imports 2019-03-20 14:34:01 -07:00
Xi Ge
643676d0d5 test: temporarily disable Interpreter/objc_class_resilience.swift for CI issue. rdar://49026933 2019-03-19 11:24:16 -07:00
Arnold Schwaighofer
a2c651504c Merge pull request #23337 from aschwaighofer/support_dynamic_replacement_of_stored_with_observer
Add support for dynamic replacement of didSet/willSet
2019-03-18 11:18:21 -07:00
Harlan Haskins
e8d474aa11 Merge pull request #23343 from harlanhaskins/mangled-lassi
[Demangle] Check for old-style mangling in getObjCClassByMangledName
2019-03-17 22:24:34 -07:00
Harlan Haskins
09bdaa35c5 [test] Test looking up resilient NSObject subclasses
Add tests to make sure we can look up resilient NSObject subclasses in the ObjC runtime.
2019-03-17 17:29:36 -07:00
Arnold Schwaighofer
35ca0e3423 Add support for dynamic replacement of didSet/willSet
The observer in a dynamic replacement of variables with a observer will
provide the dynamic replacement for the original.

var original : Int = 0 {
  didSet {
    print("original")
  }
}

@_dynamicReplacement(for: original)
var replacement : Int = 0 {
  didSet {
    print("replacement")
  }
}

rdar://48518788
2019-03-15 16:30:03 -07:00
swift-ci
497e94e89d Merge pull request #23235 from mikeash/remove-stable-abi-bit-configuration 2019-03-15 15:31:58 -07:00
Slava Pestov
1159af50d9 Rename -enable-resilience to -enable-library-evolution and make it a driver flag
Fixes <rdar://problem/47679085>.
2019-03-14 22:24:26 -04:00
Mike Ash
597dcd8f3f [Stdlib][Frontend][CMake] Remove SWIFT_DARWIN_ENABLE_STABLE_ABI_BIT option, make it permanently on. 2019-03-13 09:31:50 -04:00
Stephen Canon
8d4aa2aa9a Revert "Reapply patch with test, but this time add a pizza unicode emoji to make sure we do not use tagged pointers" (#23180) 2019-03-08 12:06:59 -05:00
Michael Gottesman
c777123c4e Fixes to make sure this test case never uses tagged pointers for strings. 2019-03-06 16:38:21 -08:00
Michael Gottesman
c9d6fa2168 Revert "Revert "Translate sil-opt bridge cast folding test into an Interpreter test." (#23142)"
This reverts commit 116820af6a.
2019-03-06 16:38:21 -08:00
Stephen Canon
116820af6a Revert "Translate sil-opt bridge cast folding test into an Interpreter test." (#23142) 2019-03-06 19:18:52 -05:00
Michael Gottesman
f5a6032b70 Translate sil-opt bridge cast folding test into an Interpreter test.
This will run with the ownership verifier and will improve our test coverage of
the cast optimizer.
2019-03-05 21:11:33 -08:00
sarveshtamba
0764671915 Changes for test failures on PowerPC64LE when running as non-root user
This test case was earlier marked as XFAIL since it was failing when run as root users( #21541 ). However, this test case now passes successfully when run as non-root(normal) user. Submitting this changeset/pull request since the test suite proceeds ahead to other test suites like those for TestFoundation, etc as non-root(normal) user successfully. Please review and approve.
2019-03-04 12:50:55 +05:30
Michael Gottesman
b466470053 Disable test that uses asan with remote_run like the rest of the asan tests.
<rdar://problem/48454650>
2019-02-27 17:37:46 -08:00
Michael Gottesman
983d1ddced Add a leaking test case for SILGenPattern that was already fixed.
We used to leak y in this example. This adds the test case to ensure that we do
not leak ever again.

rdar://40287604
2019-02-24 19:30:31 -08:00
Arnold Schwaighofer
8d9b9f328b SILGen: Fix the logic of dynamic replacements for class constructors
To correctly call designated super class initializers the designated
intializer (and not the allocator) is dynamically replaceable.
Convenience allocators are dynamically replaceable as before.
2019-02-22 10:15:06 -08:00
John McCall
7f55a4a4f0 Always give known-empty class properties a zero offset in the static layout.
Field offset vectors are always filled out with either zero or the static layout's offset, depending on the metadata initialization strategy.  This change means that the static layout's offset will only be non-zero for properties with a statically-known layout.  Existing runtimes doing dynamic class layout assign class properties a zero offset if the field offset vector entry is zero and the property is zero-sized.  So this effectively brings the compiler into accord with the runtime (for all newly-compiled Swift code, which will eventually be all Swift code because the current public releases of Swift 5 are not yet considered ABI-stable) and guarantees a zero value for the offset everywhere.

Since the runtime will agree with the compiler about the zero value of the offset, the compiler can continue to emit such offset variables as constant.  The exception to this rule is if the class has non-fragile ObjC ancestry, in which case the ObjC runtime (which is not aware of this special rule for empty fields) will attempt to slide it along with everything else.

Fixes rdar://48031465, in which the `FixedClassMetadataBuilder` for a class with a legacy-fixed layout was writing a non-zero offset for an empty field into the field offset vector, causing the runtime to not apply the special case and thus to compute a non-zero offset, which it then attempted to copy into the global field offset variable, which the compiler had emitted as a true-constant zero.
2019-02-20 00:53:11 -05:00
Saleem Abdulrasool
dc2fa3add1 test: alterations for Windows
This brings the Interpreter pass rate on Windows to 100%
2019-02-17 10:38:59 -08:00