Commit Graph

5899 Commits

Author SHA1 Message Date
Suyash Srijan
9121f45256 Merge pull request #26944 from theblixguy/fix/SR-11394
[CSDiagnostics] Fix a crasher in MissingContextualConformanceFailure
2019-08-30 07:53:31 +01:00
Suyash Srijan
016e3dc4a6 [Test] Adds a validation test 2019-08-30 00:07:58 +01:00
Varun Gandhi
e4f0f78020 Add minimal test case for rdar://problem/54580427.
The scale test says the behavior is exponential, but it should be
linear, given that (1) we provide a contextual type outside and
(2) there is precisely 1 type which has the corresponding cases.
2019-08-29 15:24:08 -07:00
Suyash Srijan
a2daa11109 Merge branch 'master' into fix/SR-10492 2019-08-28 23:48:08 +01:00
Karoy Lorentey
8fcc94f79e Merge pull request #26885 from lorentey/nein-nein-nein-nein
[test] Denineninenineninify behavioral tests added for 5.1
2019-08-28 15:23:49 -07:00
Michael Ilseman
d30ec5ba79 Merge pull request #26884 from milseman/cache_alignment
[test] Disable misaligned indices test prior to 5.1
2019-08-28 14:23:11 -07:00
Karoy Lorentey
b90e2ef776 [test] Denineninenineninify behavioral tests added for 5.1 2019-08-27 15:44:04 -07:00
Michael Ilseman
774788ac18 [test] Disable misaligned indices test prior to 5.1
Misaligned indices were fixed in 5.1, but we should disable the test
when testing back deployment.

Adds a shared helper to StdlibUnittest for the run time check.
2019-08-27 15:13:38 -07:00
Michael Ilseman
df6e977c93 Merge pull request #26856 from milseman/cache_alignment
[test] Disable some tests in back-deployment scenarios.
2019-08-26 20:07:18 -07:00
Joe Groff
164aadd1b9 Merge pull request #26857 from jckarter/reflection-context-alignment
ReflectionContext: Keep read range properly-aligned.
2019-08-26 19:34:32 -07:00
Joe Groff
33e7ed74bc ReflectionContext: Keep read range properly-aligned.
If a Mach-O image got emitted in just the wrong way, the range of `__TEXT,__swift*` sections to
read could end up starting at an unaligned address (because things like type refs have only one
byte alignment), and this would cause the reflection context to read an unaligned chunk of the
remote memory, causing alignment errors when addresses are mapped to the local copy. Keep the ranges
at least 8-byte-aligned to stave off the alignment issues we might run into with any metadata
structures, which are generally at most pointer aligned. Fixes rdar://problem/54556791
2019-08-26 16:24:26 -07:00
Michael Ilseman
9e8993551b [test] Disable some tests in back-deployment scenarios.
Bugs relating to scalar alignment and grapheme stride caching were
fixed in 5.1, so they shouldn't be tested when back deploying.
2019-08-26 16:06:52 -07:00
Arnold Schwaighofer
031dead69c Try to fix failure of this test on noasserts builds of the compiler
This test failed on the oss-swift_tools-R_stdlib-RD_test-simulator bot.

rdar://54707188
2019-08-26 08:19:26 -07:00
Suyash Srijan
f02a5f3c68 [Test] Add a test case 2019-08-25 20:06:16 +01:00
swift-ci
180a136639 Merge pull request #26821 from gregomni/sil_return_type 2019-08-24 10:11:43 -07:00
Greg Titus
3556fdf557 Sample test in compiler_crashers for sr-11232. 2019-08-24 08:56:06 -07:00
Daniel Rodríguez Troitiño
56107c2284 Merge pull request #26317 from drodriguez/windows-hack-for-crashing-tests
[windows][test] Ensure the ordering of stdout and stderr messages.
2019-08-23 15:23:20 -07:00
Arnold Schwaighofer
818d0f5c3d FAIL test on armv7k
It fails on a bot
rdar://54556791
2019-08-22 09:47:21 -07:00
Alexis Laferrière
5092d18511 Merge pull request #26653 from xymus/fix-ta-to-ta
Fix compiler crasher on type alias with a cycle in the constraints
2019-08-21 09:48:11 -07:00
Slava Pestov
c3bb0afeac Sema: Fix null dereference with invalid TypeAliasDecl
validateDeclForNameLookup() is going away and this won't happen
at all, but let's make sure we have a regression test.
2019-08-20 14:47:52 -04:00
Varun Gandhi
c85eae1efb Get rid of the second call to setType() in validateExtension().
This means that we no longer have the invariant that the extendedType always
contains the generic parameters. So we need to fix the assertions/test cases
for it.
2019-08-19 11:37:18 -07:00
Nathan Hawes
4641792fe1 [Sema] Fix null derefence when diagnosing in bindFuncDeclToOperator
Resolves rdar://problem/54150921
2019-08-15 11:44:14 -07:00
Michael Gottesman
c3b98ef63e Merge pull request #26641 from gottesmm/pr-e2ce007bc9b1b068b1e5e826b43e6973f900347d
[bug-reducer] Disable test for now until I have time to look at this.
2019-08-14 11:41:12 -07:00
Michael Gottesman
ab3db3e37a [bug-reducer] Disable test for now until I have time to look at this. 2019-08-13 14:17:42 -07:00
Alexis Laferrière
6166b222e2 Fix compiler crasher on typealias with a cycle in the constraints
rdar://problem/52463696
SR-11052
2019-08-13 10:20:40 -07:00
Slava Pestov
2f33356083 AST: Optimize construction of the AnyObject dispatch table
Instead of visiting all members of all types and extensions, bail out
early if the type is not a class or protocol, or the extension is not
extending a class. This means we don't visit structs, enums or
protocol extensions at all, which will avoid delayed parsing.

Also, we were evaluating isObjC() on each member, which is an expensive
operation; if the member does not have an explicit @objc we would still
have to check if it overrides an @objc method or witnesses an @objc
protocol requirement.

Since most members are not ever found by dynamic lookup, this is wasted
work. Instead, let's rely on AnyObject lookup filtering non-@objc
members at the call site, which it was already doing anyway.
2019-08-12 17:55:44 -04:00
Slava Pestov
14d0bbfc5e AST: Optimize construction of the global name lookup table
Only visit bodies of types and extensions that may possibly contain
operator definitions.
2019-08-12 17:15:51 -04:00
Doug Gregor
17691241e0 [Testing] Reinstate use of operator designated types in one test case.
It's an assertions-only test, which I failed to check locally.
2019-08-09 11:05:06 -07:00
Doug Gregor
566f156a27 Drop explicit use of -solver-enable-operator-designated-types in tests.
All of these tests are still "fast" even without operator designated
types. Test them in the normal type checker configuration.
2019-08-07 14:37:30 -07:00
Pavel Yaskevich
9b635833cc Merge pull request #26424 from LucianoPAlmeida/sr-8467-invalid-read-get-extra-info
SR-8467: Fixing crash on AnyFunctionType::getExtInfo
2019-07-30 19:56:46 -07:00
Luciano Almeida
1a21811797 SR-8467: Fixing crash on AnyFunctionType::getExtInfo 2019-07-30 22:08:47 -03:00
Pavel Yaskevich
5744becc34 Merge pull request #26417 from theblixguy/fix/SR-11236
[CSDiagnostics] Fix a crasher in MissingGenericArgumentsFailure
2019-07-30 16:08:45 -07:00
Daniel Rodríguez Troitiño
8bea502e8d [windows][test] Ensure the ordering of stdout and stderr messages.
It is possible that the rest of the platforms are relying in some not
clearly documented behaviour that the stdout is flushed before stderr
can be used, or something similar. Windows didn't seem to like that, and
was sometimes outputting the stderr messages interlaced with the stdout
messages (specially in the Azure testing for VS2017). The initial
solution was adding -DAG to some CHECK lines, but that doesn't cover all
the possibilities, and wasn't enabled for all the checks.

I tried to fix it in several ways, but none of them were perfect, and
many of them were deadlocking. There's a fundamental difference between
others and Windows and that is that for others stdout seems to have a
little bit of an edge in being treated first. I tried to get the Windows
code closer to that idea, but I have no luck. Some of the approaches
were using the main thread to read from the threads reading stdout and
stderr; using only the main thread and IOCP on the pipes reading from
the child process; and flushing after every output to stdout. None of
them were perfect.

The final solution is a hack, but it seems to not fail when I run the
test repeatedly in my machine, while other approaches were failing at
least once before I discarded them. The solution is including a small
sleep (1 millisecond) in the Windows code. This should yield the
execution time slice to other thread/process, which seems to do the
trick and keep the stdout before the stderr.

Hopefully this fixes the errors in Azure, and doesn't affect the rest of
the testing machines. Being a really small sleep also should not affect
the duration of the test itself.
2019-07-30 15:04:21 -07:00
Suyash Srijan
2339b5f9bd [CSDiagnostics] Move check inside getDeclContext() 2019-07-30 20:27:25 +01:00
Suyash Srijan
e50050b0fb [CSDiagnostics] Don't crash if we don't have access to the generic param's decl 2019-07-30 19:47:27 +01:00
Pavel Yaskevich
1b4f9c33eb [Diagnostic] In no exact match cases diagnose labeling mismatch as a note
Each candidate with incorrect labels (but everything else lined up)
gets a note on its declarationm which says what is expected and what
has been given.
2019-07-25 14:49:52 -07:00
Pavel Yaskevich
44f82f256f [TypeChecker] Adjust some of tests improved/regressed after removal of UR_LabelMismatch 2019-07-25 00:36:00 -07:00
Pavel Yaskevich
c28174a26c Merge pull request #26262 from xedin/new-diag-for-non-matching-overloads
[CSDiagnostics] Use special error message when call didn't match exactly
2019-07-22 13:46:40 -07:00
Pavel Yaskevich
caf266f4b1 [CSDiagnostics] Use special error message when call didn't match exactly
For multiple solutions with fixes for the same call, replace
`ambiguous reference` diagnostic with the one that explicitly
mentions that there are no exact matches, and provide partially
matched candidates as notes.
2019-07-22 11:20:56 -07:00
Jordan Rose
d71790b706 Ignore unresolved imports in @_implementationOnly consistency checking (#26255)
Unresolved imports all have the "same" ModuleDecl: nullptr. But that's
not really an inconsistency, and even if there *is* a true
inconsistency among unresolved imports, it can be dealt with when the
developer fixes their search paths. (Or the imports. Whichever is
wrong.)

rdar://problem/52943397
2019-07-22 09:14:26 -07:00
Doug Gregor
e1b359b8a4 [Type checker] Substitute into alternate properties when trying to fix wrapped property refereces
Fixes SR-11149 / rdar://problem/53204113
2019-07-19 15:40:20 -07:00
Doug Gregor
ac5e2f9dce Add now-fixed test case from rdar://problem/53183030 2019-07-19 10:30:36 -07:00
Doug Gregor
118a557304 [SE-0258] Check for a NULL type.
Within invalid code, we might encounter expressions without type
information yet. Check for NULL here.

Fixes crash from rdar://problem/53120878.
2019-07-19 10:26:26 -07:00
Doug Gregor
9f0bc69edc [Type checker] Classes don't need backing properties to create their implicit constructors
Fixes a crash caused by an undiagnosed cycle, rdar://problem/52679284.
2019-07-19 06:53:53 -07:00
Slava Pestov
84b026753e Add test case for SR-9583
https://bugs.swift.org/browse/SR-9583 / rdar://problem/47097468
2019-07-17 18:07:03 -04:00
Slava Pestov
5370ac0f03 compiler_scale tests should run full pipeline instead of just -typecheck
Now that SILGen and IRGen can trigger type checking work, we have to run the
full pipeline to get a complete picture.

Thankfully everything still passes!
2019-07-17 18:07:03 -04:00
Slava Pestov
4fa48473bc Sema: Stop finalizing struct and enum members
Since getStoredProperties() is a request that lowers lazy properties
and property wrappers to their underlying storage, and SIL can validate
stored property and enum element types, there's no longer any need for
Sema to explicitly finalize members of structs and enums. SILGen can
trigger any necessary type checkin work just by lowering a struct or
enum type.

Now the only remaining reason we need finalizeDecl() is adding implicit
methods to classes, and synthesizing accessors for storage in classes
and protocols.
2019-07-17 18:07:03 -04:00
Slava Pestov
ed3e4dc931 Sema: Add implicit constructors before checking members 2019-07-17 18:07:03 -04:00
Pavel Yaskevich
7add7446d7 Merge pull request #26074 from theblixguy/fix/SR-11074
[CS] Don't crash when default argument is magic literal and types don't match
2019-07-17 10:20:49 -07:00
Slava Pestov
56515ee871 Merge pull request #26119 from slavapestov/stored-properties-request
Re-implement NominalTypeDecl::getStoredProperties() using request evaluator
2019-07-17 09:12:47 -04:00