Commit Graph

789 Commits

Author SHA1 Message Date
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
Luciano Almeida
1a21811797 SR-8467: Fixing crash on AnyFunctionType::getExtInfo 2019-07-30 22:08:47 -03: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
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
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
48bee3825c Add regression test for rdar://48994748 2019-07-17 01:18:01 -04:00
Suyash Srijan
1a1bff46d8 [CS] Don't crash when using magic literals as default arg
Squash all commits into one
2019-07-17 01:20:25 +01:00
Doug Gregor
bee789e277 [SE-0258] Check for an invalid property wrapper type definition.
Fixes the crash-on-invalid in rdar://problem/52081852.
2019-07-08 16:07:51 -07:00
Slava Pestov
7434e37605 Sema: Fix crash with circular property initial values
Fixes <rdar://45313700>, <https://bugs.swift.org/browse/SR-9015>.
2019-06-27 23:13:46 -04:00
Slava Pestov
0a9e1c2176 Sema: Merge two places where we resolve 'Self' 2019-06-26 01:12:27 -04:00