Commit Graph

566 Commits

Author SHA1 Message Date
Max Moiseev
55fde4c923 making tests pass 2016-02-10 16:08:40 -08:00
Chris Lattner
42bc090d43 Fix compiler_crashers/28218-swift-valuedecl-settype.swift
In some completely insane cases, typechecking an EnumElementDecl
can recursively reference itself.  Make sure to produce an error
and bail out when this happens.
2016-02-09 21:46:56 -08:00
Chris Lattner
c70923e1fb Fix compiler_crashers/28220-swift-lvaluetype-get.swift by being more
careful about type transforming that produces an ErrorType.
2016-02-09 21:34:15 -08:00
Daniel Duan
6bf8bde92b update tests to reflect changes in previous commit 2016-02-07 22:10:47 -08:00
Max Moiseev
61c837209b Merge remote-tracking branch 'origin/master' into swift-3-api-guidelines 2016-02-04 16:13:39 -08:00
Chris Lattner
94dd92fcb8 Fix compiler_crashers 22725 & 28236 by reworking parameter parsing error
recovery a bit.
2016-02-01 20:50:32 -08:00
Chris Lattner
9b503272a4 fix compiler_crashers/28232-swift-typechecker-typecheckfunctionbodyuntil.swift 2016-01-31 21:46:34 -08:00
Chris Lattner
d0a9479d46 Fix compiler_crashers/28246-swift-expr-propagatelvalueaccesskind.swift
Teach CSApply that InOutExpr around an UnresolvedType shouldn't propagate
lvalue access kinds.
2016-01-31 21:08:38 -08:00
Chris Lattner
a63be90828 fix compiler_crashers/28219-swift-lvaluetype-get.swift
Not all types are l-valuable, notably InoutType's.  This seems like a
weird restriction to put in the type checker, but it is the cleanest
solution to this.  The better solution would be to change how
inoutexpr/inouttype are represented completely... maybe someday.
2016-01-29 23:18:33 -08:00
Chris Lattner
ff34db7950 fix a few compiler crashers
These were due to CSDiags not reverting the semantic expr embedded in CollectionExprs
when retypechecking them.
2016-01-29 21:13:57 -08:00
David Farler
3f635d04c7 Reinstante var bindings in refutable patterns, except function parameters.
This reverts commits: b96e06da44,
                      8f2fbdc93a,
                      93b6962478,
                      64024118f4,
                      a759ca9141,
                      3434f9642b,
                      9f33429891,
                      47c043e8a6.

This commit leaves 'var' on function parameters as a warning to be
merged into Swift 2.2. For Swift 3, this will be an error, to be
converted in a follow-up.
2016-01-29 15:27:08 -08:00
Chris Lattner
9bacb09708 Fix 24969-swift-vardecl-emitlettovarnoteifsimple.swift
A use can happen in an initializer declcontext, which has no containing method body.
2016-01-29 14:40:11 -08:00
Chris Lattner
d12a4b988d Fix 28244-swift-valuedecl-isinstancemember.swift
Formerly we stopped type checking a PatternBindingDecl when it was marked
as invalid.  This prevented semantic analysis from doing things like expanding
"stored" properties in protocols into computed properties with getters and setter,
causing downstream problems.

Stop doing this, and instead do a bit of work to silence the downstream errors in
a more narrow way.
2016-01-29 14:32:55 -08:00
Slava Pestov
1312cb8afa This test no longer crashes with an assertion, so it doesn't require asserts 2016-01-28 15:02:04 -08:00
Slava Pestov
3550897090 The previous patch accidentally fixed some compiler_crashers 2016-01-27 23:51:20 -08:00
Chris Lattner
8654282bee fix 28239-swift-declcontext-lookupqualified.swift, module lookup can be done
without access control now by diagnostics.
2016-01-25 22:08:43 -08:00
Chris Lattner
b5694e941e fix 28241-swift-valuedecl-isaccessiblefrom.swift 2016-01-25 22:06:14 -08:00
Janek Spaderna
24b5c4cd1b Move logic into one place by merging the first loop into the second
Now all the logic to resolve a type by iterating through the decl context hierarchy is moved into one place.
2016-01-25 20:43:23 +01:00
Janek Spaderna
1f0643f404 Correctly resolve associated types in nested protocols
The problem was that an associated type was always resolved with the nearest protocol `Self` as a reference, but in the case of nested protocols the associated type might be from the enclosing protocol leading to a crash.

We now enumerate in a bottom-up way through the contexts until we have found the correct protocol which provides us with the `Self` reference to resolve the associated type.
2016-01-24 14:42:18 +01:00
Joe Pamer
a59e78749d - When simplifying constraint systems generated for deeply nested binary expressions with homogeneous argument types, directly bind the parameter type variable to the argument type. This generally improves type check performance of such expressions.
- Fix the test invocation of a fixed compiler crasher - it now compiles and runs cleanly.
2016-01-22 12:34:34 -08:00
Joe Pamer
e9c44f2877 Resolve three crashers that were fixed by the last set of changes. 2016-01-22 12:34:34 -08:00
Chris Willmore
983a674e0c Make use of curried function declaration syntax an error.
<rdar://problem/23111018>
2016-01-20 21:57:38 -08:00
Dmitri Gribenko
220bac09a7 Remove 'asserts' requirements from fixed compiler crash tests 2016-01-20 14:40:36 -08:00
Max Moiseev
9a018bd77d Merge remote-tracking branch 'origin/master' into swift-3-api-guidelines 2016-01-20 14:38:22 -08:00
Chris Lattner
888c415f06 Two compiler_crashers were fixed by recent changes, update them. 2016-01-20 11:04:54 -08:00
Doug Gregor
7d70b704e4 Merge commit '5e11e3f7287427d386636a169c4065c0373931a8' into swift-3-api-guidelines 2016-01-19 23:18:20 -08:00
Dmitri Gribenko
a6352968a6 Mark a crash test as fixed 2016-01-19 20:22:10 -07:00
Chris Lattner
5ba57cb498 Fix ExprRewriter::coerceClosureExprToVoid to be resilient to type checking
closures which have already been transformed into void conversion closures.

This fixes 28213-swift-expr-walk.swift/28187-llvm-foldingset-swift-constraints-constraintlocator.swift
2016-01-17 12:07:13 -08:00
Chris Lattner
6ea637f698 Fix 28203-swift-typebase-getdesugaredtype.swift by being more careful about setting an errortype on an AssociatedTypeDecl when type checking of the containing protocoltype has failed. 2016-01-17 11:37:35 -08:00
Chris Lattner
d101ccdf98 Fix 28203-swift-typebase-getdesugaredtype.swift by being more careful about
setting an errortype on an AssociatedTypeDecl when type checking of the
containing protocoltype has failed.
2016-01-17 11:37:35 -08:00
Doug Gregor
38c1de69e4 Reinstate "[SR-511][Parse] Add 'associatedtype' keyword and fixit"
This reverts commit ce7b2bcf09, tweaking
a few validation tests appropriately (1 crasher fixed, two -verify
tests that needed updating).
2016-01-14 00:21:48 -08:00
Chris Lattner
2f78b70857 recent diagnostics changes fixed 5 crashers and broke 1. 2016-01-11 22:43:27 -08:00
Chris Lattner
8d835dee7c My diagnostics fix fixed this test along the way. 2016-01-11 20:47:47 -08:00
Max Moiseev
08e1e4a043 Merge remote-tracking branch 'origin/master' into swift-3-api-guidelines 2016-01-11 16:51:11 -08:00
Slava Pestov
cbb95a2910 Merge pull request #926 from jtbandes/innermost-params
[AST] Fix inconsistent handling of generic args & params during BoundGenericType::getSubstitutions
2016-01-09 23:30:06 -08:00
Slava Pestov
8b57337ca6 Merge pull request #910 from jtbandes/invalid-proto
[Sema] Improve handling of invalid protocols during conformance checking
2016-01-09 23:27:41 -08:00
Chris Lattner
926adfe7e4 Merge pull request #925 from jtbandes/lvalue-errortype
[Sema] Skip ErrorTypes in potential bindings during constraint solving
2016-01-09 20:19:39 -08:00
Chris Lattner
d9b2fe601b fix a compiler crash in error recovery that @practicalswift just reported. 2016-01-09 20:17:56 -08:00
Chris Lattner
11fda96b85 When we detect a property/subscript that has a setter without a getter, create a dummy
getter to avoid breaking downstream invariants.  This fixes three crashers, including
one added by @practicalswift yesterday.
2016-01-09 11:38:08 -08:00
Chris Lattner
9b5fa7935c Merge pull request #924 from jtbandes/fix-curriedself
[Sema] Fix crash in addCurriedSelfType
2016-01-09 11:18:58 -08:00
Jacob Bandes-Storch
b97cb48c2b [AST] Fix inconsistent handling of generic args & params during BoundGenericType::getSubstitutions
A decl’s full GenericSignature is set during validateGenericTypeSignature().

Then during ConstraintSystem::openTypes(), in ReplaceDependentTypes, the GenericArgs list is built from the generic signature (via getGenericParamTypes()) and passed into a new BoundGenericType.

In BoundGenericType::getSubstitutions(), the GenericArgs are assumed to match getGenericParamsOfContext()->getParams().

However, in reality, the GenericArgs include all levels of generic args, whereas getGenericParamsOfContext() are the params of the innermost context only, so the params array is accessed past its end.

This commit changes NominalTypeDecl::getGenericParamTypes() to return the innermost params, in order to match the output of BoundGenericType::getGenericArgs(). For clarity and to hopefully prevent future confusion, we also rename getGenericParamTypes() to getInnermostGenericParamTypes().
2016-01-09 02:19:28 -08:00
Chris Lattner
675ca03b12 fix a compiler crasher that practicalswift recently found. 2016-01-08 23:03:18 -08:00
Jacob Bandes-Storch
ce2f5d6ba8 [Sema] Skip ErrorTypes in potential bindings during constraint solving 2016-01-08 22:45:52 -08:00
Jacob Bandes-Storch
824c1c043b [Sema] Fix crash in addCurriedSelfType
isGenericContext() returning true doesn’t necessarily imply that getGenericSignature() returns non-null. getGenericSignatureOfContext() performs a traversal equivalent to isGenericContext(), so we use it instead.
2016-01-08 22:08:46 -08:00
Jacob Bandes-Storch
8cc8c5cc22 [Sema] Improve handling of invalid protocols during conformance checking 2016-01-08 00:27:24 -08:00
Doug Gregor
1a38e0ad3b Merge branch 'master' into swift-3-api-guidelines 2016-01-06 15:32:55 -08:00
Chris Willmore
589a46f9ba Merge pull request #858 from jder/vararg-tuple-conversion-for-args-only
[SR-433][Sema] Don't produce vararg tuples outside of arglists
2016-01-05 17:39:17 -08:00
Max Moiseev
f51e708a8f Merge remote-tracking branch 'origin/master' into swift-3-api-guidelines 2016-01-04 12:25:25 -08:00
Jesse Rusak
63faeac77c [SR-433][Sema] Don't produce vararg tuples outside of arglists
Previously, we could produce such a tuple shuffle for non-arg
tuples, which would trigger an assert in SILGen.
2016-01-02 15:37:42 -05:00
Chris Lattner
5ce3de8dd6 remove & dial back three old bits of syntax auto-upgrading support:
1. Array type parsing for postfix array types Int[].  We now handle this
   in the parser, but remove the AST representation of this old form.  We
   also stop making vague promises about the future by saying that "fixed
   size arrays aren't supported... yet".  Removal of this fixes a compiler
   crasher too.

2. Remove the special case support for migrating @autoclosure from types
   to parameters, which was Swift 1.0/1.1 syntax.  The world has moved or
   we don't care anymore.

3. Remove upgrade support for # arguments (nee "backtick" arguments), which
   was a Swift 1.x'ism abolished in an effort to simplify method naming
   rules.

NFC on valid code.
2015-12-31 22:29:39 -08:00