Commit Graph

757 Commits

Author SHA1 Message Date
David Hart
ecdcac5aa2 Resolve crasher 28704 (#8158)
This crash happens because shouldAddSelfFixit (a check for the expected_self_before_reference diagnotic) performs name lookup inside the parser, which causes a search for extensions, which triggers the mangler, which can get confused if we are in an unfinished declaration (a PatternBindingInitilizer in this case).

A cleaner fix would be to move that logic inside Sema, but it would require much more refactoring that I don’t feel comfortable doing. Instead, this band-aid checks if the innermost type is inside a local context. If that’s the case, we can ignore the search for extensions.
2017-03-17 18:43:23 -07:00
swift-ci
242a177e73 Merge pull request #8093 from hartbit/fix-crasher 2017-03-17 13:19:12 -07:00
practicalswift
b3a1f3f6d4 [gardening] Remove "// REQUIRES: asserts" from fixed crasher 2017-03-17 08:08:12 +01:00
David Hart
732ae1b2c2 Removed requires assert 2017-03-17 07:37:52 +01:00
Rintaro Ishizaki
f4f5d1d063 Mark a crasher fixed (#8150)
28722-swift-genericsignaturebuilder-resolvearchetype-swift-type.swift
has been fixed by c2224f3 #8112
2017-03-17 00:50:54 +09:00
swift-ci
34ed6b0347 Merge pull request #8067 from practicalswift/swiftc-28720-swift-typebase-getcanonicaltype 2017-03-15 16:38:57 -07:00
practicalswift
0a187da3c9 Mark as fixed. 2017-03-15 14:39:44 +01:00
David Hart
ba13a894c0 Fixed crasher 28707
The @_versioned accessibility check is done against the formal access. But the diagnostics is printed with getAccessForDiagnostics. In cases where the effective access is internal, the diagnostics will crash. Example:

```
class A { // implicitly internal
    @_versioned public var a: Int = 0 // explicity public
}
```
2017-03-15 07:38:53 +01:00
Slava Pestov
1248f8054e Sema: Fix another compiler_crasher regression from associated type where clause work
If a protocol's signature is not valid yet, don't attempt a
conformance check.
2017-03-14 00:10:44 -07:00
Slava Pestov
f0e3459068 AST: Fix compiler_crasher regression from associated type where clause work
New GenericTypeParamDecls should always be created with an
InvalidDepth, to prevent canonicalization before the generic
parameter list has been type checked.
2017-03-14 00:10:43 -07:00
Robert Widmann
6543405e2d [SR-4219] Resolve non-deterministic compiler crashes
These were leftover from the #8059, which plugged a type variable leak
caused by type checking invalid default argument expressions.
2017-03-14 00:46:50 -04:00
Robert Widmann
1367b0cb36 Invalidate default argument exprs if typechecking fails
If typechecking fails, the expression will have unsolved type variables
written into it.  This Crashes The Compiler.

In that case, there’s no reason to keep a tree of dangling references
around.  Detach the initializer expression from the AST, but continue
to typecheck it to see if we can get some useful diagnostics out of it.
2017-03-13 23:27:02 -04:00
practicalswift
811d990e5d [gardening] Mark as regressions 2017-03-13 11:39:59 +01:00
Ben Langmuir
548e956261 Attempt to fix bots that are seeing XPASS on two tests
These passed on a no-asserts bot, so add a requirement so they don't
XPASS.
2017-03-01 09:54:03 -08:00
Huon Wilson
2716c760f9 [Test] XFAIL two compiler crashers.
These are badly broken and aren't worth my timing to fix now. :(
2017-02-24 19:40:45 -08:00
practicalswift
05aa57f458 [gardening] Remove asserts from fixed crashers 2017-02-21 14:20:34 +01:00
Doug Gregor
042e6510c3 [AST] Drop ProtocolDecl's "inherited protocols" list.
The list of directly inherited protocols of a ProtocolDecl is already
encoded in the requirement signature, as conformance constraints where
the subject is Self. Gather the list from there rather than separately
computing/storing the list of "inherited protocols".
2017-02-20 09:41:00 -08:00
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