Commit Graph

272 Commits

Author SHA1 Message Date
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
swift-ci
da3943ae2b Merge remote-tracking branch 'origin/master' into master-rebranch 2020-01-13 14:43:23 -08:00
Harlan Haskins
e23e77b6a5 Allow function builder attrs on vars without bodies in interfaces (#29165)
The check for whether or not we can use a function builder on a property
checked whether the attached getter had a body, which is not always true for
module interfaces. Just disable that part of the check when compiling a
module interface.

rdar://58535753
2020-01-13 14:41:01 -08:00
swift_jenkins
8a3c5c753b Merge remote-tracking branch 'origin/master' into master-next 2020-01-08 09:57:24 -08:00
Arnold Schwaighofer
43c24be5cd Merge remote-tracking branch 'upstream/master' into master-next 2020-01-08 06:41:34 -08:00
Varun Gandhi
afc6ccdeb5 Re-land parsing and printing for Clang function types.
This reverts commit e805fe486e, which reverted
the change earlier. The problem was caused due to a simultaneous change to some
code by the PR with parsing and printing for Clang function types (#28737)
and the PR which introduced Located<T> (#28643).

This commit also includes a small change to make sure the intersecting region
is fixed: the change is limited to using the fields of Located<T> in the
`tryParseClangType` lambda.
2020-01-07 15:58:32 -08:00
Xi Ge
133e8a186f ModuleInterface: preserve AutolinkForceLoad option when generating .swiftmodule from .swiftinterface
This change ensures using .swiftmodule built from source has the same behavior as
using .swiftmodule built from .swiftinterface.

A swift-ide-test utility is added to print linked libraries from a Swift module for
testing purposes.

rdar://58057556
2020-01-06 21:17:02 -08:00
Saleem Abdulrasool
e805fe486e Revert "Clang function types v2: Electric Boogaloo (parsing + printing)" 2020-01-06 16:26:08 -08:00
Varun Gandhi
4a1a17d029 Merge pull request #28737 from varungandhi-apple/vg-v3-clang-types-in-swiftinterface
Clang function types v2: Electric Boogaloo (parsing + printing)
2020-01-06 15:42:30 -08:00
Varun Gandhi
96604470ae [AST] Add printing for Clang function types in the AST. 2020-01-06 13:00:04 -08:00