Commit Graph

540 Commits

Author SHA1 Message Date
practicalswift
14bc16417a [gardening] Remove REQUIRES lines from fixed crashers 2017-02-15 15:46:19 +01:00
Mark Lacey
f1f9e88360 Cache expression types in failure diagnosis.
After we call into typeCheckExpression() we need to cache the
resulting types in the constraint system type map because we later
call into code that reads the types out of the type map.

Fixes rdar://problem/30376186 as well as a couple crashers.
2017-02-14 19:22:41 -08:00
practicalswift
e9c6f0a318 [gardening] Remove "REQUIRES: asserts" from fixed crasher 2017-02-13 14:47:01 +01:00
Rintaro Ishizaki
49d134f1a9 [Parse] Stop lying about QuestionLoc of implicit OptionalTypeRepr (#7384)
In conditional statement let/var patterns.
Set invalid location instead.
2017-02-11 13:39:51 +09:00
Jacob Bandes-Storch
e1fd8aa6c7 [Parse] Fix crash in conditional compilation parsing (#7331) 2017-02-08 23:10:26 -08:00
Rintaro Ishizaki
ff826e3491 [Parse] Limit max nesting level of StructureMarkerRAII (#7330)
The threshold is 256, for now.
2017-02-09 15:04:09 +09:00
practicalswift
07fa66ceeb Remove "REQUIRES: asserts" from fixed crashers. 2017-02-03 09:52:34 +01:00
Slava Pestov
f2d159940c Sema: Fix corner case with @_fixed_layout diagnostic
We allow a member of a type to be more accessible than the type
itself. In this case, the broader accessibility is ignored, and
the effective access of the member is constrained by the
accessibility of its parent type.
2017-01-29 23:04:12 -08:00
Slava Pestov
fd317471a9 Sema: Fix crash with @IBDesignatable attribute on an invalid extension 2017-01-29 22:43:41 -08:00
Slava Pestov
bd625fb015 Sema: Fix crash with ignored nil literals in funny places 2017-01-28 18:35:26 -08:00
Slava Pestov
02f6bdefaa Sema: Fix crash if explicit @objc with a name is put on a deinitializer
It would be better to just ban @objc on deinit altogether, but it
was accepted in Swift 3.0.
2017-01-28 18:35:25 -08:00
Slava Pestov
7da7651345 Sema: Fix assertion failure in typo correction with static base
For some reason we weren't desugaring the base type, so the
metatype check would fail.
2017-01-28 18:35:25 -08:00
Slava Pestov
d3966d2567 Parse: Fix recursive diagnostic corner-case with invalid UTF8 in source file 2017-01-28 18:35:25 -08:00
Slava Pestov
93385af35c Sema: Fix for circularity in unqualified lookup when resolving DeclRefExpr 2017-01-28 18:35:25 -08:00
Slava Pestov
93bab2b072 Sema: There's no implicit conversion from a closure result of optional Void 2017-01-28 18:35:24 -08:00
Slava Pestov
505c533f00 Sema: Hack for unresolved type in call argument matching 2017-01-28 18:35:24 -08:00
Slava Pestov
974e2e1e9e Sema: Fix @warn_unqualified_access crash 2017-01-28 18:35:24 -08:00
Slava Pestov
3fd645ba0b Sema: Fix assertion failure for constructor call on non-nominal type 2017-01-28 18:35:24 -08:00
Slava Pestov
45a19ddf2d Sema: Fix assertion failures with UnresolvedType in diagnostics
We sometimes construct DependentMemberTypes with an UnresolvedType
base. These are not "real" interface types and can end up in
places where we don't expect interface types, triggering an
assertion. Make sure such types don't respond true to hasTypeParameter().
2017-01-28 18:35:23 -08:00
Slava Pestov
cdb6c3859a Sema: Fix assertion failures with unresolved types in coerceToType() 2017-01-28 18:35:23 -08:00
Slava Pestov
5cbaa9d7a6 Sema: When simplifying types, build ErrorTypes for failed conformance lookups 2017-01-28 18:35:23 -08:00
Jordan Rose
7c8117301a In Swift 3 mode, allow "tuple unsplatting" in certain cases. (#7077)
Swift 3.0 allowed constructing an enum or calling a function-typed
property with multiple arguments even when a single argument of tuple
type was expected. Emulate that in Swift 3 mode by wrapping in an
extra level of parentheses when the situation comes up.

Last vestiges of fallout from SE-0110. Hopefully last, anyway. A nice
follow-up to this commit might be to /warn/ in Swift 3 mode when this
happens.

rdar://problem/30171399
2017-01-27 11:19:07 -08:00
Slava Pestov
55c0e7401c Sema: Fix crash when @noescape or @autoclosure is applied to parameter
In Swift 3, these attributes were changed to apply to the type,
and not the parameter. If they appear on the parameter, we would
go down a diagnostic code path.

When checking a generic function signature, we might not have a
contextual type for the parameter yet, so bail out instead of
crashing.
2017-01-23 23:54:50 -08:00
Slava Pestov
a67f4bdff4 Merge pull request #6948 from matthewcarroll/SR-3599-Better-Recovery-For-Decl-Names
[DiagnosticsQoI] SR-3599: Better recovery for decls with consecutive identifiers
2017-01-23 17:37:07 -08:00
Matthew Carroll
6285579855 Remove the expectation of this test crashing, and move it into the compiler crashers fixed test suite.
The crash was fixed accidentally in 93a7a9f80d.
2017-01-22 13:20:04 -05:00
practicalswift
23d53a3a4a Remove REQUIRES annotation from fixed crashers. 2017-01-21 10:32:59 +01:00
Pavel Yaskevich
671d470322 [Diagnostics] Don't attempt member lookup if base type has unresolved type parameters
If there are unresolved generic parameters present and we are trying
to diagnose problems related to initializer call, it makes sense to
check argument expression first, which might be erroneous and then move
on to the ambiguity checking instead of trying to lookup possible
constructors directly.
2017-01-19 14:01:57 -08:00
practicalswift
39a35729ef Mark previously non-deterministic crashers as fixed. 2017-01-18 10:29:12 +01:00
swift-ci
36ab93a95d Merge pull request #6860 from DougGregor/optional-conversions 2017-01-17 15:11:12 -08:00
Doug Gregor
ecfea608db [Type checker] Classify the various optional conversion kinds.
1efafbcd9b restricted our classification
of various optional-related conversions (implicit forcing of IUOs,
optional-to-optional conversions, value-to-optional conversions) to
produce a single potential classification. However, in the presence of
type variables, we cannot always determine which particular conversion
restriction might apply. Prior to 1efafb, we produced too many
options; after 1efafb, we produced too few. Here, enumerate a more
bounded (but complete) set of potential conversions, taking into
account embedded type variables.

This is a better fix for rdar://problem/29977523 than simply reverting
1efafb, because it bounds the set of optional conversions we attempt.
2017-01-17 13:10:26 -08:00
Pavel Yaskevich
35b0ffeff8 [Diagnostics] Fix diagnoseImplicitSelfErrors to accept only valid argument types.
Add additional checks before trying to re-check argument expression in
`FailureDiagnosis::diagnoseImplicitSelfErrors` and before trying to use
its resulting type, which can only be either tuple or paren type.
2017-01-17 01:49:09 -08:00
Slava Pestov
9bc057c156 Merge pull request #6846 from rintaro/crasher-crasher-28600
[Lexer] Disable all SIL_KEYWORDs in non-SIL mode
2017-01-16 18:48:06 -08:00
Slava Pestov
c49be072d1 Merge pull request #6826 from xedin/implicit-cleanup
[QoI] Move from RAII to direct sub-expression cleanup. NFC
2017-01-16 15:47:42 -08:00
Slava Pestov
6d5e4822a2 Merge pull request #6844 from rintaro/crasher-crasher-28602
[Diag] Don't attempt 'fixOverrideDeclarationTypes' when indices count doesn't match for subscript
2017-01-16 15:40:34 -08:00
Jacob Bandes-Storch
8673a60c0d [Sema] Add missing case to %select in resilience diagnostics (#6847)
Fixes a crasher added in #6839.
2017-01-16 11:28:23 -08:00
Rintaro Ishizaki
0affdb057d [Lexer] Disable all SIL_KEYWORDs in non-SIL mode
Instead of long '||' conditions, use SIL_KEYWORD in Tokens.def.
2017-01-16 23:33:54 +09:00
Rintaro Ishizaki
3952e0043c [Diag] Don't attempt 'fixOverrideDeclarationTypes' when indices count doesn't match for subscript
Fixes a crasher
2017-01-16 22:51:35 +09:00
Pavel Yaskevich
6f217dbe2a [ConstraintSystem] Don't attempt to solve candidates which have closures.
While shrinking constraint system, avoid candidates which contain
closures inside, because closure expressions require special handling
and allow no rollback.
2017-01-15 14:15:04 -08:00
practicalswift
de87201237 Mark crashers as fixed. 2017-01-14 17:56:32 +01:00
Pavel Yaskevich
488fc0fad5 [QoI] Cleanup AST after trying to shrink constraint system of invalid expression
Since `ConstraintSystem::shrink` is going to attempt to type-check
sub-expressions separately it's essential to clean-up AST if constraint
generation or solving of the such expressions fails, otherwise if
such solving resulted in creation of implicit expression type variables
might leak to the outside.
2017-01-13 17:20:56 -08:00
Arnold Schwaighofer
e46e63ebc6 Revert "[QoI] Cleanup AST after trying to shrink constraint system of invalid expression" 2017-01-13 13:35:19 -08:00
Pavel Yaskevich
9b7d632160 [QoI] Cleanup AST after trying to shrink constraint system of invalid expression
Since `ConstraintSystem::shrink` is going to attempt to type-check
sub-expressions separately it's essential to clean-up AST if constraint
generation or solving of the such expressions fails, otherwise if
such solving resulted in creation of implicit expression type variables
might leak to the outside.
2017-01-13 00:39:37 -08:00
practicalswift
c9e534d4ea [gardening] Fix annotations for fixed crashers 2017-01-07 21:05:03 +01:00
practicalswift
a076f6cf27 Update crashers with correct annotations. 2017-01-07 18:44:35 +01:00
Robert Widmann
d2570cb964 Restore local type declarations list 2017-01-06 16:16:39 -07:00
Robert Widmann
9c7a6cfaa3 Fix a crasher 2017-01-06 16:16:39 -07:00
practicalswift
7e66ecfde8 Mark previously non-deterministic compiler crashes as fixed. 2017-01-06 23:01:34 +01:00
practicalswift
6d1ae2a39c [gardening] 2016 → 2017 2017-01-06 16:41:22 +01:00
practicalswift
724e2efa02 [gardening] Remove "REQUIRES: asserts" from fixed crashers 2017-01-06 16:38:25 +01:00
Erik Eckstein
8cf641ce2b Mangling: fix crash when mangling an identifier which has a unicode char as first character and a digit as second char. 2017-01-04 16:20:09 -08:00