Commit Graph

32761 Commits

Author SHA1 Message Date
Rintaro Ishizaki
0d82f1e80d Merge pull request #24685 from rintaro/sourcekit-test-pureswift-sysmodule
[SourceKit] Add InterfaceGen test case for pure Swift system module
2019-05-10 15:16:20 -07:00
Daniel Rodríguez Troitiño
f0a6948632 [android] Add a test for Android conditional compilation (AArch64)
There are similar tests for other architectures/OS pairs, but
android-aarch64 was missing. This should ensure that the conditional
compilation for Android works correctly in this case.
2019-05-10 14:38:13 -07:00
Brent Royal-Gordon
387fc08e6c Disable Prototypes/TextFormatting in 32-bit
The new ImmutableAddressUseVerifier asserts when it tries to compile it. rdar://problem/50676315
2019-05-10 14:26:28 -07:00
Daniel Rodríguez Troitiño
b67b45aae6 [android] Modify lit replacement of module-target-triple for ARMv7
Android ARMv7 has an LLVM triple of armv7-none-linux-androideabi, but
the Swift module triple is just armv7-node-linux-android. The change
removes the "eabi" bit for the %module-target-triple substitution of lit
to avoid an error in the test
test/SourceKit/CursorInfo/cursor_swiftonly_systemmodule.swift.

Android AArch64 wasn't affected because the LLVM triple for it is just
aarch64-none-linux-android.
2019-05-10 14:10:23 -07:00
Slava Pestov
4643cbd8e9 GSB: Remove another call to resolveDeclSignature()
The GSB should avoid triggering declaration validation where
possible, to avoid problems resulting from circularity and as
a general performance rule-of-thumb.

This last call was there to catch self-recursive protocol
typealiases. However, we can diagnose this problem elsewhere,
which allows us to emit a more accurate diagnostic as well.
2019-05-10 15:00:48 -04:00
Slava Pestov
cc53fd9518 Fix archive_attributes test to work on macOS 10.9
That OS doesn't have objc_readClassPair(). This test uses -target to
explicitly select a newer deployment target and then runs the binary
on an old OS to test the behavior. However this means arclite won't
get linked in unless we also pass in -link-objc-runtime.

Fixes <rdar://problem/50610877>.
2019-05-10 14:54:34 -04:00
Mike Ash
5a8a0a816e [Test] Guard SwiftNativeNSXXXCoding tests behind #available(9999).
These tests fail when run against older runtimes since they don't have the fix.

rdar://problem/50504800
2019-05-10 14:51:05 -04:00
swift-ci
fca1128d55 Merge pull request #24678 from mikeash/errorbridgedstatic-says-goodbye 2019-05-10 10:18:46 -07:00
Rintaro Ishizaki
6c8641b9b1 [SourceKit] Add InterfaceGen test case for pure Swift system module
rdar://problem/50458412
2019-05-10 10:12:24 -07:00
Michael Gottesman
2ae51ca0aa Merge pull request #24610 from gottesmm/pr-2df2f80b348fecaae23a17b6aa3272de096fd075
[sil] Expand immutable address use verification to in_guaranteed parameters.
2019-05-10 09:55:10 -07:00
Mike Ash
5c6a93ef2b [Test] Delete ErrorBridgedStatic test.
This test checks that error bridging with ObjC bridging works when the stdlib is statically linked. We no longer support static linking of the stdlib on platforms with ObjC interop.

rdar://problem/49699316
2019-05-10 12:07:24 -04:00
Michael Gottesman
afe3114d3d [sil] Expand immutable address verification to in_guaranteed parameters.
rdar://50212579
2019-05-09 23:01:43 -07:00
Michael Gottesman
179251d167 [sil-combine] Do not perform existential type propagation on @in parameters when we have a copy of the underlying value.
Otherwise, we may get use-after-frees as in the added test.

rdar://50609145
2019-05-09 23:01:43 -07:00
Sam Lazarus
dcf27a516f Merge pull request #24660 from sl/sl/sr-3245
Sema / Test: Fix misplaced fix-it for .init calls on instances
2019-05-09 20:22:07 -04:00
Rintaro Ishizaki
104ece8eb7 Merge pull request #24620 from rintaro/serialization-swiftonly-system-module
[Serialization] Support Swift only system module
2019-05-09 16:23:31 -07:00
Sam Lazarus
3d432fea65 Sema / Test: Fix misplaced fix-it for .init calls on instances 2019-05-09 19:17:39 -04:00
Brent Royal-Gordon
4f1e05cbeb [AST] Give appendInterpolation refs a SourceLoc
This change permits UnresolvedDotExpr to have both a name and a base that are implicit, but a valid DotLoc, and to treat that DotLoc as the node’s location. It then changes the generation of string interpolation code so that `$stringInterpolation.appendInterpolation` references have a DotLoc corresponding to the backslash in the string literal.

This makes it possible for `ExprContextAnalyzer` in IDE to correctly detect when you are code-completing in a string interpolation and treat it as an `appendInterpolation` call.
2019-05-09 15:29:21 -07:00
Brent Royal-Gordon
da74978a8d [Parse] Parse string interpolations as args
Now that we manipulate the argument list to correct strange interpolations in Sema, we can parse interpolations directly as argument lists, simplifying the parser.

By itself, this refactoring causes a code completion regression; a subsequent commit will fix that.
2019-05-09 15:29:21 -07:00
Brent Royal-Gordon
a4e5bcea6a Move strange interpolation fix to PreCheckExpression
This defers diagnosis until a stage where #if conditions have definitely been evaluated, at the cost of a slightly more complex implementation. We’ll gain some of that complexity back in a subsequent refactoring. Fixes SR-9937.
2019-05-09 15:29:21 -07:00
Argyrios Kyrtzidis
9d30bf5037 Merge pull request #24606 from akyrtzi/swift-test-stdlib-depend-cmake
[test/CMake] Add the `swift-test-stdlib-*` test dependency under the same conditions as `swift-reflection-test*`
2019-05-09 15:25:08 -07:00
Sam Lazarus
2309ee580a Merge pull request #24617 from sl/sl/sr-10297
Add a Diagnostic for .init calls which should be transformed into assignments (SR-10297)
2019-05-09 18:05:38 -04:00
Mike Ash
d7c0a61c93 Merge pull request #24618 from mikeash/self-awareness-class-struggle
[Runtime] Avoid +class overrides when initializing an ObjC class.
2019-05-09 16:31:10 -04:00
Andrew Trick
320759227a Canonicalize stores in the CanonicalizeInstruction utility.
This is the complement to load canonicalization. Although store
canonicalization is not required before diagnostics, it should be
defined in the same utility.
2019-05-09 13:00:39 -07:00
Sam Lazarus
a13dba93b2 Test: Add tests for .init called on mutable value inside operator 2019-05-09 15:40:15 -04:00
Mike Ash
893e291739 [Runtime] Add a test for +class and +self overrides.
rdar://problem/49853091
2019-05-09 13:11:05 -04:00
Arnold Schwaighofer
c3bf40c9d7 Merge pull request #24621 from aschwaighofer/opaque_specializer_fixes
Opaque specializer fixes
2019-05-09 07:59:12 -07:00
Slava Pestov
0da04ca1ed Merge pull request #24631 from slavapestov/reapply-weak-class-stubs-tests
Fix REQUIRES lines on class stubs tests
2019-05-09 10:53:30 -04:00
Pavel Yaskevich
ce406fca04 Merge pull request #24615 from xedin/fix-autoclj-returning-fn-type
[ConstraintSystem] Allow arguments to be passed by value to `@autoclo…
2019-05-09 00:48:53 -07:00
Sam Lazarus
85051c519c Test: Add a test exercising expressions with an immutable base 2019-05-08 23:38:14 -04:00
Pavel Yaskevich
860cddfd34 [ConstraintSystem] Allow arguments to be passed by value to @autoclosure parameters
Instead of always requiring a call to be made to pass argument
to `@autoclosure` parameter, it should be allowed to pass argument
by value to `@autoclosure` parameter which can return a function
type.

```swift
func foo<T>(_ fn: @autoclosure () -> T) {}
func bar(_ fn: @autoclosure @escaping () -> Int) { foo(fn) }
```
2019-05-08 19:41:35 -07:00
Slava Pestov
52fbe642ed Fix REQUIRES lines on class stubs tests
We use the just-built clang without any -target or -sdk flags. Keep things
simple and limit the test to macOS for now.

Fixes <rdar://problem/50586614>.
2019-05-08 22:22:27 -04:00
Rintaro Ishizaki
d3d30ee246 [Serialization] Support Swift only system module
Previously 'isSystemModule()' returns true only if the module is:
- Standard library
- Clang module and that is `IsSystem`
- Swift overlay for clang `IsSystem` module

Now:
- Clang module and that is `IsSystem`; or
- Swift overlay for clang `IsSystem` module
- Swift module found in either of these directories:
  - Runtime library directoris (including stdlib)
  - Frameworks in `-Fsystem` directories
  - Frameworks in `$SDKROOT/System/Library/Frameworks/` (Darwin)
  - Frameworks in `$SDKROOT/Library/Frameworks/` (Darwin)

rdar://problem/50516314
2019-05-08 17:03:06 -07:00
Arnold Schwaighofer
9685aaff33 Test case for previous 3 fixes
rdar://50592605
    rdar://50591831
    rdar://50589978
2019-05-08 14:16:00 -07:00
Rintaro Ishizaki
558cc6382e Merge pull request #24455 from rintaro/ide-complete-import-swiftmodule
[CodeCompletion] Complete Swift only module name after 'import'
2019-05-08 14:02:34 -07:00
Brent Royal-Gordon
4bc22c7f77 Merge pull request #24611 from nathawes/disable-test-interpreter-subclass-existentials-to-unblock-ci
[test] Disable test/Interpreter/subclass_existentials.swift to unblock CI
2019-05-08 12:49:48 -07:00
Sam Lazarus
4f1dbdbcc4 Test: Add tests for .init calls that should be transformed into assignments 2019-05-08 15:42:56 -04:00
Nathan Hawes
af3fbc52b3 Revert "Add tests for weak-linked class stubs" 2019-05-08 10:55:00 -07:00
Nathan Hawes
30c7ab8c27 [test] Disable test/Interpreter/subclass_existentials.swift to unblock CI
It's been failing in CI since enabling the existential specializer by default:
https://ci.swift.org/job/oss-swift_tools-RA_stdlib-RD_test-simulator/2043/
2019-05-08 10:30:50 -07:00
Mike Ash
0ea82d6890 Merge pull request #24534 from mikeash/swiftnativexxx-warnings-fix
[Stdlib] Fix warnings about designated initializers in SwiftNativeXXX classes.
2019-05-08 13:26:28 -04:00
Rintaro Ishizaki
ffde2280c9 [CodeCompletion] Hide 'SwiftOnoneSupport' from module name completion 2019-05-08 10:12:29 -07:00
Rintaro Ishizaki
502f5302c2 [test] Add test cases for Swift module completion after 'import' 2019-05-08 10:11:52 -07:00
Argyrios Kyrtzidis
d26a053d86 [test/CMake] Add the swift-test-stdlib-* test dependency under the same conditions as swift-reflection-test* 2019-05-08 09:16:52 -07:00
Slava Pestov
7d96de54e8 Merge pull request #24601 from slavapestov/remove-old-inout-expr-check
Remove MiscDiagnostics diagnosis of invalid InOutExprs
2019-05-08 08:11:44 -04:00
Slava Pestov
431343bd06 Merge pull request #24603 from slavapestov/checked-clang-importer-accessors
ClangImporter: Built type-checked expressions in union and indirect field accessors
2019-05-08 08:11:31 -04:00
Pavel Yaskevich
d417017c86 Merge pull request #24593 from xedin/extend-use-of-missing-call-diagnostics
[ConstraintSystem] Extend use of missing explicit call fix
2019-05-08 00:31:10 -07:00
Slava Pestov
3371080b9f ClangImporter: Built type-checked expressions in union and indirect field accessors
When we remove Sema's UsedConformances list, conformances to _BridgedStoredNSError
are checked from SILGen, where its too late to check function bodies of synthesized
functions.

We could solve this by adding a callback to type check a synthesized function's
body, but in fact all synthesized functions are rather trivial so it's better to
build their bodies fully type checked.

Start by building fully checked expressions for various accessors in ClangImporter.
2019-05-08 01:09:33 -04:00
Slava Pestov
fd2dd9f8a4 Sema: Fix OperatorArgumentConversion with LHS of InOutType
We don't require or allow '&' for the mutable parameters in
operator calls, since we want to write 'x += 10' and not
'&x += 10'.

The constraint sovler accepted '&x += 10' though, and we had
a separate pass in MiscDiagnostics for rejecting it.

Instead, let's just reject this in the solver.

The main difficulty is that we must now be prepared to fail
certain OperatorArgumentConversion and ApplicableFunction
constraints even when both the LHS and RHS types are equal.
2019-05-07 23:10:48 -04:00
Slava Pestov
5938f5a6a9 Merge pull request #24585 from slavapestov/weak-link-class-stubs
Add tests for weak-linked class stubs
2019-05-07 23:10:16 -04:00
Pavel Yaskevich
cb3252e055 [ConstraintSystem] Extend use of missing explicit call fix
Now covers following new areas (alongside simple assignments):

- Contextual type coercions:
  - In assignment e.g. `let _: X = foo`
  - In return type positions e.g. `func foo() -> A { return bar }`

- Argument-to-parameter applications (including @autoclosure)
2019-05-07 16:41:19 -07:00
Pavel Yaskevich
49710ab7cd Merge pull request #24587 from xedin/diag-extraneous-return-via-fixes
[ConstraintSystem] Detect and diagnose extraneous returns from void f…
2019-05-07 16:39:23 -07:00