Commit Graph

5277 Commits

Author SHA1 Message Date
Karoy Lorentey
e08b219448 Merge pull request #23683 from lorentey/casting-improvements
[stdlib] Fix Set/Dictionary casting issues
2019-04-15 10:56:38 -07:00
Slava Pestov
39a22f3d6a AST: Remove ParameterTypeFlags::Escaping
Escapingness is a property of the type of a value, not a property of a function
parameter. Having it as a separate parameter flag just meant one more piece of
state that could get out of sync and cause weird problems.

Instead, always look at the noescape bit in a function type as the canonical
source of truth.

This does mean that '@escaping' is now printed in a few diagnostics where it was
not printed before; we can investigate these as separate issues, but it is
correct to print it there because the function types in question are, in fact,
escaping.

Fixes <https://bugs.swift.org/browse/SR-10256>, <rdar://problem/49522774>.
2019-04-15 00:25:03 -04:00
Saleem Abdulrasool
149f6b6b81 test: disable test for incorrect behaviour
This test is testing that the verifier aborts on invalid input.
SR-10459
2019-04-11 18:54:02 -07:00
Karoy Lorentey
3c74c0f1cb [stdlib] Change the signature of Dictionary’s bulk initializer (#23758)
The initializer was originally introduced without proper availability; in https://github.com/apple/swift/pull/23643, we fixed this by applying the `@_alwaysEmitIntoClient` attribute. However, this had the unfortunate side-effect that the symbol disappeared from `libswiftCore.dylib`, which somehow confuses some simulator builds.

Try to figure out what’s happening by replacing the third closure argument with an integer return value. This changes the mangled name of the bulk initializer, which should make it more obvious how/why these builds fail.

rdar://problem/49479386
2019-04-03 10:51:36 -07:00
Slava Pestov
0f53290cb2 Add regression test for fixed bugs
<rdar://problem/39826863>, and <https://bugs.swift.org/browse/SR-9508>.
2019-04-02 19:00:01 -04:00
Slava Pestov
016cb690ae Merge pull request #23730 from slavapestov/assorted-bug-fixes
Assorted bug fixes
2019-04-02 17:38:29 -04:00
Slava Pestov
1caf2c7544 Sema: Fix code completion crash when a ParamDecl hasn't had its type set yet
We set the type of ParamDecls when applying solutions in the normal path, but
sometimes code completion will type check an expression inside a closure without
checking the outer expression. In this case, we may have inferred a type for
the ParamDecl, but we don't write it back.

Instead, just look at the DeclRefExpr's type.

Fixes <rdar://problem/42098113>.
2019-04-02 00:25:24 -04:00
Slava Pestov
88e41231cc Sema: Skip non-single-expression closure bodies in MiscDiagnostics
This is a defensive move to avoid duplicated work and guard against crashes
when a multi-expression closure body or TapExpr has not been type checked yet.

Fixes <rdar://problem/48852402>.
2019-04-02 00:25:24 -04:00
Karoy Lorentey
ceb703b840 [test] Add new Set/Dictionary casting tests 2019-03-29 19:15:23 -07:00
Michael Ilseman
0ece62d911 [String] Add Substring.base
Adds Substring.base, analogous to Slice.base, to access the entire
String.

Tests added.
2019-03-29 15:43:00 -07:00
Pavel Yaskevich
da3468aeca Merge pull request #23652 from xedin/rdar-49371608
[ConstraintSystem] Delay adding contextual requirements until parent …
2019-03-29 01:37:42 -07:00
Pavel Yaskevich
8e420496b2 [ConstraintSystem] Delay adding contextual requirements until parent type is opened
`openUnboundGenericType` eagerly tries to add conditional requirements
associated with chain of parents of the given type if type has been
declared inside of constrained extension. But one of the parent types
might be unbound e.g. `A.B` which means it has to be opened, which
by itself, would add such requirements.

Resolves: rdar://problem/49371608
2019-03-28 22:08:33 -07:00
Argyrios Kyrtzidis
dd40c70496 Merge pull request #23627 from akyrtzi/fix-bad-deserial-49336277
[Serialization] Fix bad tagging of deserialized decls that can result in failed member lookups
2019-03-28 15:36:42 -07:00
Argyrios Kyrtzidis
1b2cb9c723 [Serialization] Fix bad tagging of deserialized decls that can result in failed member lookups
The issue was introduced in ec95e68ab9 which changed the behavior of `ModuleFile::getDeclChecked()` slightly.

rdar://49336277
2019-03-28 12:18:25 -07:00
Daniel Rodríguez Troitiño
b56d9d1bfb Merge pull request #23543 from drodriguez/mark-string-switch-as-executable
[test] Mark string_switch.swift as executable test.
2019-03-26 10:50:35 -07:00
Daniel Rodríguez Troitiño
9d7728ff55 [test] Mark string_switch.swift as executable test.
The test might want to be split in two, because it does both checks for
the output of the compilation, and the run time itself, but for now mark
it as executable, so it doesn't break the Android test suite (which
cannot execute tests).
2019-03-25 15:02:36 -07:00
Joe Groff
797839f197 Merge pull request #23497 from theblixguy/fix/SR-10146
[CSApply] Fix a KeyPath crash in SIL when base type is AnyObject
2019-03-25 14:13:41 -07:00
Xi Ge
97233420b8 test: disable FixedPointConversion tests while investigating related CI failures. rdar://49177883 2019-03-24 11:51:14 -07:00
David Zarzycki
e5f8e30c15 [Testing] Mark FixedPointConversion tests as "long_test" (#23522)
As of 14d89ec1c1, these tests now take
2.25x longer than the *entire* validation test suite on fast machines.
Mark them as "long_test" for now until they can be broken into smaller
concurrent tests.
2019-03-24 13:21:39 -04:00
Suyash Srijan
676d914e7c [csapply] do not proceed with a key path whose base type is AnyObject 2019-03-22 20:42:58 +00:00
Arnold Schwaighofer
a67f3b919d Merge pull request #23452 from aschwaighofer/add_test_optimize_none_implicit_dynamic
Add a test mode to exercise implicit dynamic
2019-03-22 06:24:14 -07:00
Saleem Abdulrasool
3be7b4eacc Merge pull request #19503 from drodriguez/android-aarch64-test-script
[android] Modify test scripts for aarch64 and modern NDKs.
2019-03-21 16:41:43 -07:00
Daniel Rodríguez Troitiño
4dcf60ca0f [test] Fix FixedPointConversion tests (#23220)
Fix several problems with FixedPointConversion generation code.

The first problem is that at some point `repr(value)` was being used,
which turn the number into a string. That was great for printing the
number, but make the test against the value of the number (like
`testValue < otherMin` always false. There were a number of tests that
were never performed, specifically the integer tests.

The second problem was using doubles in the Python code. For Float32 and
Float64 the tests were generated correctly, but in the case of Float80,
the test adding or removing a quantity to the maximum/minimum were
failing because of the lack of precission (Adding 0.1 to a very
big/small number is the same as not adding anything). Switching to
Decimal should keep enough precission for the tests.

Finally the last problem was that the bounds of the conversions are not
actually `selfMin` and `selfMax`, but the values returned by the utility
function `getFtoIBounds`. For example for unsigned types, the lower
bound is always -1, not zero (every value between -1 and zero is rounded
to zero, and doesn't fail).

Instead of using nested gyb templates, use lit.cfg %target-ptrsize,
which should be faster, cleaner, and provides correct line-directive
output.

Remove a bunch of warnings in Swift when compiling the generated result
of FixedPointConversion.swift.gyb.

Co-authored-by: Gwynne Raskind <gwynne@users.noreply.github.com>
2019-03-21 13:58:30 -04:00
Arnold Schwaighofer
e113ef8c93 Add a mode to test implicit dynamic with private imports 2019-03-20 14:34:01 -07:00
Daniel Rodríguez Troitiño
6d5309a6c4 [android] Modify test scripts for aarch64 and modern NDKs.
Many places on the testing scripts for Android have the ARMv7
architecture hardcoded. Modify all those instances to support both ARMv7
and AArch64.

Besides the paths being modified depending on the architecture, the
script is also modified to adapt to NDK beyond r14, where the headers
are not under the SDK root, but under a unified sysroot. Two new include
paths are passed to the compiler invocations (one the general one, one
the architecture specific one).

In order to link correctly, the -tools-directory is passed to the Swift
compiler invocation. In order to use a modern linker, the selected
linker in the CMake script is written in the lit.site.cfg.in files. The
system will prefer lld, but will fallback to gold. Plain ld will not be
used, since it cannot link correctly the binaries.

There's a new CMake variable named SWIFT_ANDROID_${ARCH}_ICU_DATA that
should point to libicudataswift.so for each architecture. This part of
ICU is necessary while running the test in the host, so it needs to be
uploaded. Since it is normally side by side with other ICU products, the
linker was finding it for free.
2019-03-20 11:31:50 -07:00
Xi Ge
0d830d6174 Merge pull request #23423 from nkcsgexi/rdar49026133
Temporarily disable several tests failing on CI
2019-03-19 11:27:08 -07:00
Xi Ge
b2b128caa0 test: temporarily disable several failing tests on CI. rdar://49026133 2019-03-19 11:18:05 -07:00
Jordan Rose
ce0178fc13 Merge pull request #23357 from theblixguy/fix/SR-10108
[Sema] Fix a crash when attempting to synthesise raw representable conformance
2019-03-19 07:30:48 -07:00
Suyash Srijan
146f705087 [test] prefix the RUN arguments with 2019-03-18 22:40:50 +00: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
fbce6e7873 [StdlibUnittest] Allow tests to require a new process
When testing runtime lookup changes, we want to make sure each test runs in isolation. Add a new modifier, `.requireOwnProcess()`, to enable tests to guarantee they’re run in isolation.
2019-03-17 17:29:36 -07:00
Suyash Srijan
4eebc8e46f [Sema] Don't attempt to derive raw representable conformance if the enum elements have a payload 2019-03-16 23:39:13 +00:00
swift-ci
6e7202e0f6 Merge pull request #23174 from lorentey/tacoma-narrows 2019-03-15 14:48:33 -07:00
Slava Pestov
8e14023868 Merge pull request #23280 from slavapestov/enable-resilience-flag
Rename -enable-resilience to -enable-library-evolution and make it a driver flag
2019-03-15 14:26:16 -04:00
Arnold Schwaighofer
9605f1d1ae Merge pull request #23300 from aschwaighofer/string_memory_test
Improve StringMemoryTest.swift
2019-03-14 19:29:32 -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
Rintaro Ishizaki
d01e80d499 Merge pull request #23308 from rintaro/ide-completion-rdar48896424
[CodeCompletion] Fix an assertion failure
2019-03-14 14:53:54 -07:00
Rintaro Ishizaki
71aeea93f5 [CodeCompletion] Fix an assertion failure
If the type has unbound generic parameter, we cannot substitute types
for member decls.

rdar://problem/48896424
2019-03-14 12:22:19 -07:00
Arnold Schwaighofer
588b4d6c08 Improve StringMemoryTest.swift
The test fails on some bots as written before.

rdar://48845923
2019-03-14 10:54:20 -07:00
Rintaro Ishizaki
fad6ba9459 Merge pull request #23243 from rintaro/ide-completion-rdar48698892
[CodeCompletion] Move a test to long test suite
2019-03-12 16:55:25 -07:00
Rintaro Ishizaki
51234d498a [CodeCompletion] Move a test to long test suite
rdar://problem/48698892
2019-03-12 12:26:35 -07:00
Pavel Yaskevich
9802875ce1 Merge pull request #23187 from theblixguy/fix/SR-10062
[Typechecker] Disallow default argument to inout parameter
2019-03-12 12:11:00 -07:00
Rintaro Ishizaki
2924be7ba0 Merge pull request #23192 from rintaro/ide-completion-infix-rdar48648877
[CodeCompletion] Fixed a crasher regarding malformed operator decl
2019-03-12 11:20:37 -07:00
swift-ci
5a351609ee Merge pull request #23163 from apple/lit-dispatch-feature 2019-03-11 20:22:26 -07:00
Suyash Srijan
e21430a6af [typechecker] disallow default argument to inout parameter 2019-03-12 02:57:28 +00:00
Julian Lettner
c0674b7ef8 [testsuite] Allow libdispatch tests to run on non-Apple platforms
The lit feature `objc_interop` is used as a proxy for the availability
of libdispatch and Foundation.

Although we don't support Obj-C on non-Apple platforms, we support
libdispatch and Foundation. Let's break up `objc_interop` into
finer-grained categories so we can run more tests on non-Apple
platforms.

This patch adds lit features `libdispatch` and `foundation` (currently
only enabled on Apple platforms) and removes the `objc_interop`
dependency from libdispatch tests.
2019-03-08 16:53:40 -08:00
Rintaro Ishizaki
19e54fed78 [CodeCompletion] Fixed a crasher regarding malformed operator decl
Infix operator completion used to crash if multiple infix operators with the
same name are declared in the module.

rdar://problem/48648877
2019-03-08 16:31:31 -08:00
Karoy Lorentey
d467b6fcac [test] Add tests for Set/Dictionary force-bridging failure cases 2019-03-07 19:57:13 -08:00
Arnold Schwaighofer
8cc813d624 Reduce the time spend in StringMemoryTest
Measure the increase.
rdar://problem/48658000
2019-03-07 07:36:53 -08:00
Mishal Shah
98ad5a496e Revert "[StringMemoryTest] Reduce # of iterations down to 1M and lower memory threshold" 2019-03-07 00:15:34 -08:00