Commit Graph

804 Commits

Author SHA1 Message Date
Suyash Srijan
d1e61a3000 [Test] Add test case for SR-11600 to compiler_crashers_2_fixed 2019-11-04 23:55:39 +00:00
Suyash Srijan
573aceeba3 [ConstraintSystem] Don't create a AllowArgumentMismatch fix when there is an argument type mismatch in synthesized wrappedValue init
This is because we already emit a diagostic to tell the user that the property's type does not match the wrappedValue type, so this diagnostic can be a bit confusing especially because the initializer is synthesized
2019-11-04 22:29:13 +00:00
Suyash Srijan
a5935d1ff7 [PropertyWrappers] Mark the property as invalid when it's type fails to match the type of the wrappedValue property
Otherwise, we will end up producing wrong diagnostics as well as crashing later on in certain cases
2019-11-04 22:29:13 +00:00
Slava Pestov
547fdaa3b8 Merge pull request #28026 from slavapestov/orts
Small cleanup to aid debugging and some regression tests
2019-11-02 09:00:44 -04:00
Andrew Trick
fd6497bbc7 SILCombine cleanup; replace null check with dyn_cast_or_null.
Remove 'not' and add '-emit-sil' to the corresponding lit test's run line.
2019-11-01 21:36:35 -07:00
Andrew Trick
4e106fb2e4 Merge pull request #28012 from zoecarver/fix/optimizer-and-SR-11624
Fix crash when optimizing protocol composition
2019-11-01 19:52:42 -07:00
Slava Pestov
07f8f551ed Add a regression test for SR-8968
Also rdar://problem/45217645.
2019-11-01 18:55:16 -04:00
Slava Pestov
116c5bfd5b Add a regression test for rdar://problem/56700017 2019-11-01 18:55:16 -04:00
zoecarver
ddade0a33d Add validation test under compiler crashers fixed 2019-11-01 10:29:34 -07:00
Robert Widmann
0af343469b Pre-Request Cleanup For Implicit Constructors
Push through an easy refactoring to the way we validate and install
implicit constructors.  This patch would be NFC but for a regression
test that now must diagnose.  #26159 changed validation order in such
a way that the code in validation-test-macosx-x86_64/compiler_crashers_2_fixed/0124-sr5825.swift
used to be accepted.  This patch once again changes validation order, so
we now reject this code, restoring the behavior seen on all prior
versions of Swift.

On its face, this test should work.  In order for it to do so, witness
matching has to be smarter about the declarations it asks for their
interface type, or it will risk these circular constructions
accidentally being accepted or rejected on a whim.
2019-10-31 13:13:08 -07:00
Robert Widmann
86e5ed18a0 Add a bailout path to protocol requirement source formation
The GSB will try to form and note invalid constraints, but there are
a few paths that aren't prepared for error types to pop up.  Add
a defensive check to formProtocolRelativeType to make sure we don't wind
up force-casting an error type.

Fixes rdar://56116278
2019-10-25 13:08:41 -07:00
Holly Borla
e5c99cace6 Merge pull request #27769 from hborla/anyobject-conformance-failure
[ConstraintSystem] Diagnose missing AnyObject conformance using the MissingConformance constraint fix.
2019-10-18 22:10:21 -04:00
Holly Borla
dca1373e46 [ConstraintSystem] Don't fail in matchTypes when two primary archetype types
are not equal when part of a type requirement. This allows the
SkipSameTypeRequirement constraint fix to be applied instead.
2019-10-18 17:34:03 -07:00
Brent Royal-Gordon
ca25640cc3 Merge branch 'master' into everything-evil 2019-10-14 13:24:03 -07:00
Doug Gregor
99d9c94ab9 Add now-fixed test case for rdar://problem/45590743 2019-10-11 20:54:52 -07:00
Brent Royal-Gordon
eca51d4d53 Fix keypath-as-function crasher
The autoclosures generated for the keypath-as-function feature were not added to the list of closures that needed captures computed. In top-level code, this caused a crash. Fixes rdar://problem/56055600.
2019-10-08 18:11:41 -07:00
Hamish Knight
e2096ae34d [CSDiagnostics] Tweak candidate note text for arg mismatch
Number the parameters starting at 1 in order to
match other diagnostics such as
diag::missing_argument_positional, and change the
text to make it explicit that we're referring to
the parameter position (rather than argument
position).
2019-10-03 15:26:31 -07:00
Brent Royal-Gordon
6456b39660 Fix StringInterpolationProtocol validation crasher
Some old circularity-breaking code caused an unexpected null type, which led to crashes in the decl checker when trying to check that an `appendInterpolation` method in a different file would satisfy the informal requirement for one in a StringInterpolationProtocol conformer. This code appears to now be unnecessary, so this commit removes it. Fixes rdar://problem/55864759.
2019-10-01 17:43:42 -07:00
Pavel Yaskevich
10b1baebb2 Merge pull request #27362 from xedin/port-missing-args
[Diagnostics] Port missing argument(s) diagnostics
2019-09-25 21:08:54 -07:00
Pavel Yaskevich
ec6a874ac8 [TypeChecker] NFC: Update test-cases improved by new missing arguments diagnostic 2019-09-25 10:47:26 -07:00
Robert Widmann
a331dee8e4 Merge pull request #27340 from CodaFi/party-crashers
Extensions Do Not Have Parent Signatures
2019-09-24 15:24:56 -07:00
Robert Widmann
574a450537 Extensions Do Not Have Parent Signatures
Remove the parent signature from consideration when computing the
generic signature for an extension.  This cuts off a series of crashers
that involved nested extensions with trailing where clauses a la

extension Foo {
  extension Foo where Self.Undefined == Bar {
  }
}

The inner (invalid) extension technically has a parent signature from
Foo itself.  Adding that signature to the GSB means when we go to
register the inner extension's generic parameters we crash.

Since extensions have to occur at the top level, just remove the parent
signature from consideration.

Fixes rdar://55502661
2019-09-24 13:13:51 -07:00
Suyash Srijan
9c97153b2a [Test] Adds a test case 2019-09-24 00:45:29 +01:00
Slava Pestov
8fab074bb5 AST: Fix regression from SubstFlags::UseErrorTypes removal
Note that while the original crasher in the radar is gone, my reduced test
case triggers an IRGen crash on both 5.1 and master because of an unrelated
bug that appears to be related to protocol requirement signatures and
declaration ordering.

Fixes <rdar://problem/54952911>.
2019-09-19 15:50:40 -04:00
Holly Borla
bf80250c84 Merge remote-tracking branch 'upstream/master' into type-cannot-conform-diag 2019-09-17 11:54:03 -07:00
Holly Borla
2a7e0099d2 [Diagnostics] Add notes for the type_cannot_conform error that point
to the declaration that requires protocol conformance.
2019-09-17 09:22:07 -07:00
Holly Borla
173e4526ee [Diagnostics] Adjust wording of type_cannot_conform error message. 2019-09-16 14:55:38 -07:00
Pavel Yaskevich
f302da0f9b Merge pull request #27063 from xedin/diag-arg-conversion-failure
[Diagnostics] Introduce argument-to-parameter mismatch
2019-09-16 01:14:15 -07:00
Doug Gregor
d74a24be37 [AST] Look through ConstructorRefCallExpr to find direct callee.
Fixes SR-11062 / rdar://problem/54141935
2019-09-13 22:37:43 -07:00
Pavel Yaskevich
001f46231c [Diagnostics] Fix a typo in argument mismatch diagnostic note 2019-09-13 22:35:52 -07:00
Pavel Yaskevich
a1643d94f7 [Diagnostics] NFC: Update all of the improved test-cases 2019-09-13 22:35:52 -07:00
Holly Borla
40985b6eb7 [Diagnostics] Generalize the "protocol type cannot conform" error to
work for all types that cannot conform to protocols.
2019-09-13 14:51:17 -07:00
Holly Borla
0434d58ff0 Merge pull request #27123 from hborla/missing-conformance-diag
[ConstraintSystem] Allow fixing missing conformance failures for `Void` and uninhabited types.
2019-09-12 17:41:19 -07:00
Holly Borla
911bcee863 [Test] Update compiler_crashers_2_fixed/0196-rdar48937223.swift with new
missing conformance diagnostics.
2019-09-12 14:23:54 -07:00
Doug Gregor
6329fc0a92 Add fixed crasher from rdar://problem/54609704 2019-09-12 08:55:35 -07:00
Luciano Almeida
28d3c6c668 Addressing CR comments 2019-09-07 15:06:45 -03:00
Luciano Almeida
ef8af2a057 Adding valid conventions on tests 2019-09-07 12:30:19 -03:00
Luciano Almeida
697c6d1b13 Check for @autoclosure and @convention(c/block) 2019-09-07 11:14:16 -03:00
Luciano Almeida
3401d24945 Adding crasher sr11027 2019-09-07 10:14:39 -03:00
Pavel Yaskevich
5210e9b7c2 Revert "[AST] Paren'd reference to an IUO function crashes the compiler in SILGen" 2019-09-02 11:02:01 -07:00
Suyash Srijan
bd53fe355d Revert "[CS] Don't crash when default argument is magic literal and types don't match" 2019-08-31 00:54:37 +01:00
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
Suyash Srijan
f02a5f3c68 [Test] Add a test case 2019-08-25 20:06:16 +01: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
Nathan Hawes
4641792fe1 [Sema] Fix null derefence when diagnosing in bindFuncDeclToOperator
Resolves rdar://problem/54150921
2019-08-15 11:44:14 -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
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