Commit Graph

1131 Commits

Author SHA1 Message Date
Saleem Abdulrasool
e3548dd638 test: use -log-path for stderr access in ModuleInterface tests
The stderr handles seem to behave differently under Python 3.  Use the
`-log-path` option to capture the standard error output and validate the
output.
2020-07-09 17:19:55 +00:00
Nathan Hawes
9bcb54910e [AST] Prefer the 'macOS' spelling over 'OSX' when printing the platform kind.
This affects module interfaces, interface generation in sourcekitd, and
diagnostics. Also fixes a fixit that was assuming the 'OSX' spelling when
computing the source range to replace.

Resolves rdar://problem/64667960
2020-07-08 13:51:25 -07:00
Hamish Knight
241c5d95e3 Merge pull request #32461 from hamishknight/its-all-linked 2020-07-08 11:07:17 -07:00
Mishal Shah
1899d2c06b [Apple Silicon] Mark macOS tests that require x86_64 2020-07-02 16:28:41 -07:00
Mishal Shah
92ca9fc924 [Apple Silicon] Generalize tests for other macOS architectures
Most of the changes fall into a few categories:
* Replace explicit "x86_64" with %target-cpu in lit tests
* Cope with architecture differences in IR/asm/etc. macOS-specific tests
2020-07-02 16:27:46 -07:00
Hamish Knight
b3dcef9796 Avoid unnecessary linking in SIL tools
Previously we were linking in all SIL entities
if the input was a serialized non-SIB AST, and
`-disable-sil-linking` wasn't specified. However
none of the tests appear to want this behaviour.

Stop calling `SerializedSILLoader::getAll`, and
remove the `-disable-sil-linking` option, as this
is now the default behaviour.
2020-07-01 23:14:01 -07:00
Robert Widmann
89ae325d22 Use Formal Access To Compute Override Elision Check
The effective access of an overridden declaration is subject to
escalation by -enable-testing. When this is flag is enabled, an
interface containing an internal-overriding-public declaration will
still print `override`. This is because the effective access of the base
of the override is formally internal but effectively public.

Instead, use the formal access scope of the overridden declaration to
compute its access relative to the override. While I'm here, catch the
case where the base declaration is `@usableFromInline` and therefore
*will* be printed in the interface. We treat these declarations as
effectively public for the purpose of printing `override`.

Resolves rdar://64969741
2020-06-30 21:28:42 -07:00
Saleem Abdulrasool
240ae1b589 test: make make-unreadable Python 3 friendly
Make `make-unreadable` python 3 compatible.  `POINTER` is now in
`ctypes` rather than in `ctypes.wintypes`.  Use the new location which
is compatible across python 2 and python 3.
2020-06-24 09:00:21 -07:00
Alexis Laferrière
b4f2e63df8 [ModuleInterface] Prefer the swiftmodule in the SDK over the prebuilt-cache
Fix the search order for module interfaces to respect the documented
behavior:

1. Local cache
2. Next to the .swiftinterface
3. Prebuilt cache

Fixing the order of the last two allows the XcodeDefault compiler to
prioritize swiftmodule files with SPI information.

rdar://problem/64097455
2020-06-17 08:36:08 -07:00
Pavel Yaskevich
16862e50a5 Merge pull request #31713 from xedin/no-ranking-with-ambiguous-with-fixes
[ConstraintSystem] Overhaul ambiguity diagnostics
2020-06-16 12:55:14 -07:00
3405691582
c8ba437444 [test] Handle architecture aliasing for OpenBSD.
Swift calls the architecture x86_64, OpenBSD calls it amd64. If we use
run_cpu in lit.cfg as-is, then we may need to duplicate lines in each
test for 'x86_64' and 'amd64', which puts a maintenance burden on unit
test developers to ensure they are duplicating changes to each line.

Instead, alias 'amd64' to 'x86_64' for `run_cpu`, but keep the platform
module path referring to 'amd64', in order to distinguish the target
architecture name and the Swift architecture name. This is particularly
relevant for the %target-.*-name pseudovariables used, which should
reference the Swift architecture names.

However, some unit tests are directly referencing %target-cpu directly,
which would break the aliasing. This is done only for swiftinterface
files, so a new substitution is defined in lit.cfg for these variables,
and the affected unit test cases are migrated.
2020-06-12 21:06:37 -04:00
Pavel Yaskevich
d23b938331 [Diagnostics] Implement IgnoreAssignmentDestinationType::diagnoseForAmbiguity
For cases like this:

```swift
struct X {}
struct Y {}

func overloaded<T>(_ value: T) -> T { value }
func overloaded<T>(_ value: T) -> Int { 0 }

func test(x: inout X, y: Y) {
  x = overloaded(y)
}
```

Solver would record a `IgnoreAssignmentDestinationType` fix per overload,
`diagnoseForAmbiguity` could be used to properly diagnose ambiguity cases
like that.
2020-06-12 11:47:04 -07:00
Doug Gregor
014466de5a [Function builders] Update test case 2020-05-29 20:59:44 -07:00
Doug Gregor
8cec6b555d [Function builders] Add tests for function builders on protocol requirements 2020-05-25 23:42:45 -07:00
David Zarzycki
5dcc32f98f Remove all uses of -force-single-frontend-invocation
The `-force-single-frontend-invocation` flag predates WMO and is now an
alias for `-whole-module-optimization`. We should use the latter and let
the former fade into history.
2020-05-08 06:37:41 -04:00
Robert Widmann
fb8e23e94f Propagate Failures Explicitly in Opaque Type Resolution
This code should not yield the null Type() on failure. Instead, diagnose
the failure and yield an ErrorType. This matches what clients of this
function expect to signal failure.

Include a regression test that exercises a common failure mode if we
don't do this: module interface loading crashes.

rdar://62745419
2020-05-01 18:22:38 -07:00
Brent Royal-Gordon
f7c4c9e920 Reduce path length of swift_build_sdk_interfaces Catalyst fixtures
#31342 moved a file to a path that’s too long for our Windows builders. Collapse the directory structure a bit to get it under the limit.
2020-04-28 20:42:24 -07:00
Varun Gandhi
a1716fe2a6 [Diagnostics] Update compiler diagnostics to use less jargon. (#31315)
Fixes rdar://problem/62375243.
2020-04-28 14:11:39 -07:00
Brent Royal-Gordon
0c54e2d6e0 Rename Mac Catalyst-related test
Fixes rdar://62338598
2020-04-27 12:02:49 -07:00
Brent Royal-Gordon
92e3b5f785 Merge pull request #31288 from brentdax/reacting-to-reactivekit
Fix ReactiveKit failure seen in source compatibility suite
2020-04-24 21:20:05 -07:00
swift-ci
d385e2826f Merge pull request #31298 from varungandhi-apple/vg-update-arm64e-fallback-test 2020-04-24 17:20:34 -07:00
Varun Gandhi
fb1f65b80a [NFC] [arm64e] Mark arm64e fallback test unsupported for Catalyst.
Fixes rdar://problem/62337141.
2020-04-24 15:11:01 -07:00
Brent Royal-Gordon
e7bd60494a Revert "[ModuleLoader] Emit a better diagnostic for swiftinterfaces with wrong arch."
This reverts commit 412ee0a922.
2020-04-24 13:45:05 -07:00
Brent Royal-Gordon
9b252821d6 Add test case for failure seen in source compat suite
Master source compat suite job #4912 failed to build ReactiveKit because Combine does not have an interface for older iOS architectures that were retired before it was released, and a change to module loading diagnosis started to consider switfinterfaces. Add a test case that covers this situation.
2020-04-24 13:45:05 -07:00
Doug Gregor
94e9153878 Merge pull request #31170 from DougGregor/build-module-triples
[CMake] Use proper module triples for the names of standard library modules
2020-04-23 23:57:50 -07:00
Doug Gregor
58296b9dab Update test for building module interfaces for an SDK 2020-04-23 21:33:36 -07:00
Varun Gandhi
412ee0a922 [ModuleLoader] Emit a better diagnostic for swiftinterfaces with wrong arch.
Before this change, we would emit the warning only for swiftmodules; however,
it may be the case that only a swiftinterface (of a different arch) is present
but no swiftmodule is present.

Fixes rdar://problem/50905075.
2020-04-22 23:58:54 -07:00
Varun Gandhi
c4134ca452 [ModuleInterface] Remove fallback behavior for arm64e -> arm64.
Addresses rdar://problem/61407215.
2020-04-22 23:58:33 -07:00
Varun Gandhi
93958ed76b [NFC] Add test case for old arm64e fallback behavior. 2020-04-22 23:57:48 -07:00
Doug Gregor
b27b4d4bb6 [CMake] Use proper module triples for the names of standard library modules.
The standard library (and other Swift modules built by our CMake build system)
has been building module files with an architecture only (e.g., x86_64.swiftmodule)
rather than a proper module triple (x86_86-apple-macosx10.15,
x86_64-apple-ios13.0-simulator, etc.), unlike every other build
system. There are hacks in the compiler and other tools to cope with
this unnecessary build difference. Fix the module file names so we'll
be able to remove the hacks later.

Fixes rdar://problem/49071536.
2020-04-20 21:16:14 -07:00
Suyash Srijan
724f8c23db [Typechecker] Implement SE-0268 Refine didSet Semantics (#26632) 2020-04-09 01:23:15 +01:00
Xi Ge
b00698d977 ModuleInterface: print function-builder custom attribute only on parameters
Printing this attribute on other definitions isn't necessary.

rdar://58544718
2020-03-19 15:41:08 -07:00
Xi Ge
b717fafedb Merge pull request #30509 from nkcsgexi/58562780
ModuleInterface: skip override keywords when overriding an invisible decl from super class
2020-03-19 14:11:10 -07:00
Xi Ge
75abee8f45 ModuleInterface: skip override keywords when overriding an invisible decl from super class
When we are printing Swift interface, we have to skip the override keyword
if the overriden decl is invisible from the interface. Otherwise, an error
will occur while building the Swift module because the overriding decl
doesn't override anything.

We couldn't skip every `override` keywords because they change the
ABI if the overriden decl is also publicly visible.

For public-override-internal case, having `override` doesn't have ABI
implication. Thus we can skip them.

rdar://58562780
2020-03-19 11:47:54 -07:00
Slava Pestov
9ec80df97e SIL: Remove curried SILDeclRefs 2020-03-19 02:20:21 -04:00
Xi Ge
45d0eca9c7 ModuleInterface: consider inherited protocols from super class when collecting handled protocols
Protocol conformances can be implied by super classes. When collecting the list
of IncludedProtocols, we should traverse the class inheritance chain and collect
all protocols.

Without this change, these implied conformances will be printed again via a synthesized
extension at the end of the Swift interface file, leading to an error of redundant
conformances when building modules.

rdar://58563540
2020-03-18 17:21:13 -07:00
Brent Royal-Gordon
a7a5e340aa Improve diagnostic for broken module interfaces
Currently, when a swiftinterface file fails to load, we emit the specific diagnostics for the failures, followed by a generic “failed to load module ‘Foo’” message. This PR improves that final diagnostic, particularly when the cause may be that the interface was emitted by a newer compiler using backwards-incompatible syntax.
2020-03-13 20:31:55 -07:00
Joe Groff
808d33d016 IRGen: Don't cache accesses to fixed class metadata.
The only initialization these class objects need is ObjC realization, which can be done
fast with `objc_opt_self` on recent Apple OSes. The cache check just adds code size and
dirties memory.
2020-02-26 15:10:18 -08:00
swift-ci
c59f1aa6ba Merge pull request #29797 from CodaFi/clotheslined 2020-02-12 15:55:29 -08:00
Robert Widmann
e5d9fef296 Add a regression test for the @usableFromInline pattern in rdar://59171169
Make sure we don't print @_hasMissingDesignatedInitializers in the swift
interface when we actually can see all the designated initializers.
2020-02-12 14:13:52 -08:00
Robert Widmann
12d542c24f Specialize a test for Windows
An unfortunate workaround for rdar://59397376

Resolves rdar://59318361
2020-02-12 12:45:43 -08:00
Mishal Shah
db8bf0bd29 Merge pull request #29744 from apple/master-rebranch
Merge master-rebranch into master to support new llvm branch apple/stable/20200108
2020-02-10 17:50:40 -08:00
Robert Widmann
6d40e7b350 XFAIL a test holding up the rebranch process 2020-02-10 11:24:15 -08:00
swift-ci
822408fbc6 Merge remote-tracking branch 'origin/master' into master-rebranch 2020-01-29 14:23:11 -08:00
Slava Pestov
3c86061de8 Sema: Fix module interface printing of inherited generic initializers
Make sure we use the sugared form of GenericTypeParamType and not
the canonical type.

Fixes <rdar://problem/58578998>.
2020-01-29 12:32:22 -08:00
swift-ci
3e4ceaa05d Merge remote-tracking branch 'origin/master' into master-rebranch 2020-01-16 08:43:11 -08:00
Erik Eckstein
1b312a85bd Merge remote-tracking branch 'origin/master' into master-rebranch 2020-01-16 10:39:20 +01:00
Daniel Rodríguez Troitiño
eb90ff2def [test][android] Mark inherits-superclass-initializers-client as executable.
The test uses %target-run, which requires executing code. Android CI
cannot execute code because no device is attached. Marking the test as
executable skip it in the Android CI machines.
2020-01-15 14:40:57 -08:00
Arnold Schwaighofer
3a520e674e Disable test that fails spuriously
This test fails sometimes with something like:

SOURCE_DIR/test/ModuleInterface/ModuleCache/prebuilt-module-cache-forwarding.swift:47:8: error: malformed compiled module: BUILD_DIR/test-macosx-x86_64/ModuleInterface/ModuleCache/Output/prebuilt-module-cache-forwarding.swift.tmp/MCP/Lib-2XZQCTV44N470.swiftmodule

rdar://58578342
2020-01-15 06:04:41 -08:00
Saleem Abdulrasool
546c5b79ab tests: fix accidental not env usage
Manually expand out the few places where we had a `not ...` substitution
where the substituted value was invoking `env` to alter the environment.
This pattern is not portable and causes problems when using the
integrated shell, such as on Windows.  This was identified during the
LLVM update.

This additionally corrects the use of `not` to indicate that it is
expecting a crashing failure.  This was resulting in the Windows tests
failing as `not` was not expecting a crashing failure.
2020-01-14 13:29:14 -08:00