Commit Graph

1575 Commits

Author SHA1 Message Date
practicalswift
b55d606412 Update with last commit of synced repo. 2015-12-11 21:47:34 +01:00
practicalswift
fe2bc2421e Sync with https://github.com/practicalswift/swift-compiler-crashes
Add 5 compiler crashes (+ 1 fixed crash).
2015-12-11 21:35:06 +01:00
Slava Pestov
f6e4355b69 Sema: Fix monthly TypeNullifier bug
This time, the issue is that TypeNullifier skips bodies of
multi-statement closures. However, ExprRewriter will type
happily pass them on to typeCheckClosureBody(). This could
trigger assertions. Fix this by skipping type checking of
multi-statement closures when diagnosing.

There seems to be a minor QoI regression in some test cases
that already looked pretty dodgy and/or had FIXMEs. However
I think its worth fixing a crash.
2015-12-11 08:58:52 -08:00
practicalswift
0ae877ac2c Use canonical "-emit-silgen" to trigger crash case. 2015-12-11 10:51:46 +01:00
Max Moiseev
7c4a693c3c fixing OptionSetType related tests 2015-12-10 16:59:18 -08:00
Maxim Moiseev
2c95bb6d51 BooleanType => Boolean 2015-12-10 14:56:32 -08:00
Jacob Bandes-Storch
61dea21228 Fix crash in DependentGenericTypeResolver::resolveDependentMemberType
An erroneous `baseTy` would cause resolveArchetype to return nullptr, resulting in a null dereference.
2015-12-10 14:52:53 -08:00
Dmitri Gribenko
5995ef2acd Mark one crasher test as fixed on OS X 2015-12-10 14:30:17 -08:00
Jacob Bandes-Storch
71b15e9a06 [AST] Improve ErrorType handling in TypeBase::getMemberSubstitutions()
Historical note: a similar change was made in 0033bda.
2015-12-10 13:11:06 -08:00
Dmitri Gribenko
3e5ce67605 Merge pull request #398 from practicalswift/rename-to-match-naming-in-swift-compiler-crashes
Rename old crash cases to match the current naming scheme.
2015-12-10 13:02:21 -08:00
Max Moiseev
d610fa0d1c Merge remote-tracking branch 'origin' into swift-3-api-guidelines 2015-12-10 10:29:52 -08:00
practicalswift
c4866885c8 Rename old crash cases to match the current naming scheme.
Will allow for easy import of crash cases from swift-compiler-crashes.
2015-12-10 16:50:15 +01:00
practicalswift
159d58dd8c Sync with https://github.com/practicalswift/swift-compiler-crashes
Add 5 compiler crashes.
2015-12-10 15:44:25 +01:00
Maxim Moiseev
844b81c46b SequenceType => Sequence 2015-12-09 17:16:56 -08:00
Maxim Moiseev
7e2466c14e CollectionType => Collection 2015-12-09 17:12:48 -08:00
Max Moiseev
67f02296a4 Fixing validation tests
There is no longer a free `map` function so one of the crashers goes to
'fixed', and another one is changed to use `print` instead of a
`println`.
2015-12-09 17:11:54 -08:00
Dmitri Gribenko
2cf172160c Rename SequenceType.Generator associated type to SequenceType.Iterator 2015-12-09 17:11:05 -08:00
Chris Lattner
1a1ccd1975 My diagnostics changes from last night fixed these three crashers, move them and remove --crash. 2015-12-08 09:02:24 -08:00
Max Moiseev
d0e1cb3a0e Merge remote-tracking branch 'origin/master' into swift-3-api-guidelines 2015-12-07 16:43:20 -08:00
Jacob Bandes-Storch
e437a0e14c Fix duplicate error and re-categorize test
This crashing test became non-crashing in #138. #138 also emitted multiple instances of the same diagnostic, which was causing -verify to fail on decl/protocol/req/recursion.swift.
2015-12-07 02:28:37 -08:00
Jacob Bandes-Storch
b8bfdbc72e Fix logic error in ArchetypeBuilder::mapTypeIntoContext 2015-12-06 14:33:06 -08:00
practicalswift
aff2d73867 Mark as fixed. 2015-12-06 06:17:23 -05:00
practicalswift
f781fbb820 Sync with https://github.com/practicalswift/swift-compiler-crashes
Add 342 compiler crashes.
2015-12-06 05:34:53 -05:00
Dmitri Gribenko
174d475833 stdlib: Remove unavavailable APIs that were left as migration aids
These APIs are from the Swift 1.2 => Swift 2.0 transition, and are not
relevant anymore.

Removing them reduces the surface area of the library that needs to be
reviewed.
2015-12-02 01:19:50 -08:00
Dmitri Gribenko
4f8773f40e Add a test feature 'swift_ast_verifier' 2015-11-30 21:07:13 -07:00
Chris Willmore
48987d6a20 Update validation test suite after fixing 21967211.
Commit da15fbf fixed 32 compiler crashers.
2015-11-10 23:09:54 -08:00
Doug Gregor
ea3d0b37bf Archetype builder: clean up typo correction and unresolved references.
When typo-correcting a potential archetype (i.e., a nested name
T.foo), record the rename within the potential archetype but don't
consider the signature to be invalid. Move the actual typo-correction
diagnostics and AST fix-ups outside of the archetype builder, so we
get proper Fix-Its and a correct generic signature. Fixes
rdar://problem/20789924.

Swift SVN r32677
2015-10-14 06:27:28 +00:00
Doug Gregor
70968a38fc Use the iterative type checker for TypeChecker::resolveInheritedProtocols.
Swift SVN r32564
2015-10-09 17:18:42 +00:00
Doug Gregor
f247447f03 Iterative type checker: compute inherited protocols of a protocol.
Introduce a type check request for computing inherited protocols and
start using it in a few places.

Swift SVN r32562
2015-10-09 17:18:40 +00:00
Doug Gregor
2feed84c91 Sketch out the interface to an iterative, lazy type checker.
This is all effectively NFC, but lays out the shape of the iterative
type checker: requests are packaged up in TypeCheckRequest, we can
check whether the request has been satisfied already (isSatisfied),
enumerate its dependencies (enumerateDependenciesOf) in terms of other
TypeCheckRequests, and satisfy a request (satisfy).

Lazily-computed semantic information is captured directly in the
AST, but has been set aside in its own structure to allow us to
experiment with moving it into a lookaside table.

The only request that exists now is to type-check the superclass of
the given class. It currently performs unhealthy recursion into the
existing type checker. As we detangle dependencies, this recursion
between the IterativeTypeChecker and the TypeChecker can go away.

Swift SVN r32558
2015-10-09 17:18:36 +00:00
Doug Gregor
34106f7f32 Include the Self type of a protocol type in the list of "all" generic arguments.
It's never bound, but this maintains invariants better and fixes a
number of crashes.

Swift SVN r32430
2015-10-04 06:18:15 +00:00
Doug Gregor
98dadc9800 Teach resolveTopLevelIdentTypeComponent not to modify the component.
Instead, always return the computed Type and let the caller deal with
it. NFC except for accidentally fixing a crasher.

Swift SVN r32377
2015-10-01 20:17:24 +00:00
Slava Pestov
69981a63eb Fix a handful of compiler_crashers were failing on OS X but passing on Linux
I'm too lazy to XFAIL: these, so fix the crash instead.

Swift SVN r32188
2015-09-23 22:27:36 +00:00
Slava Pestov
28c8d0b30d Remove duplicate compiler_crashers
Swift SVN r32187
2015-09-23 22:27:26 +00:00
Slava Pestov
864cc29ccf Remove timeout tests for now
rdar://22812658 tracks re-enabling these.

Swift SVN r32171
2015-09-23 00:59:06 +00:00
Slava Pestov
9fcf7f1bb9 Import latest compiler crashers and regressions from practicalswift
Swift SVN r32157
2015-09-22 21:08:21 +00:00
Doug Gregor
7a3f05a07a Reduce dependency on IdentTypeRepr::getBoundType().
Having bound types in TypeReprs causes trouble in several places
(mostly involving type-checking of generics), and doesn't really fit
with TypeReprs being a mostly syntactic construct. Eliminate some code
paths using getBoundType(), and make the others do the same thing for
getBoundDecl() and getBoundType(). As part of the latter, provide
TypeBase::getDirectlyReferencedTypeDecl() to more easily map from type
to the named declaration.

Swift SVN r32018
2015-09-16 23:25:19 +00:00
Doug Gregor
cab320296d Stop recording protocol lists in nominal types.
The conformance lookup table is responsible for answering queries
about the protocols to which a particular nominal type conforms, so
stop storing (redundant and incorrect) protocol lists on the ASTs for
nominal types. Protocol types still store the list of protocols that
they inherit, however.

As a drive-by, stop lying about the number of bits that ProtocolDecl
uses on top of NominalTypeDecl, and move the overflow bits down into
ProtocolDecl itself so we don't bloat Decl unnecessarily.

Swift SVN r31381
2015-08-21 17:51:23 +00:00
Doug Gregor
f0fcd594c0 Stop using TypeDecl::Protocols within abstract type parameters.
More baby steps toward sinking protocol lists down into
NominalTypeDecl. Fixes another 12 crashers along the way.

Swift SVN r31333
2015-08-19 06:42:30 +00:00
Doug Gregor
f898887894 Eliminate getConformsTo() callback from the archetype builder.
The getConformsTo() callback was responsible for forcing the
collection of the requirements directly placed on an associated type,
which then get added to the archetype builder. This resulted in an
unhealthy dependency on the list of protocols attached to TypeDecl
(which should go away). Instead, retrieve the requirements from the
associated type's archetype (once it's been computed) or directly from
its list of "inherited" types (while we're building the generic
signature for the protocol itself).

Swift SVN r31332
2015-08-19 06:42:27 +00:00
Doug Gregor
dd93c6390b Teach name lookup to cope with missing archetypes on associated types.
Name lookup shouldn't even depend on such semantic information, but
this fixes 13 crashers.

Swift SVN r31331
2015-08-19 06:42:23 +00:00
Chris Lattner
654cb861ed fix <rdar://problem/21886435> Swift compiler crashes on "()=()"
... which was just a pair of over-conservative SILGen assertions.

This was our shortest practical swift crasher.



Swift SVN r31135
2015-08-11 17:41:44 +00:00
Chris Lattner
a899872d91 Reapply r31105, with some fixes to invalid unconstrained generics. These fixes correct
the regressions that r31105 introduced in the validation tests, as well as fixing a number
of other validation tests as well.

Introduce a new UnresolvedType to the type system, and have CSDiags start to use it
as a way to get more type information out of incorrect subexpressions.  UnresolvedType
generally just propagates around the type system like a type variable:
 - it magically conforms to all protocols
 - it CSGens as an unconstrained type variable.
 - it ASTPrints as _, just like a type variable.

The major difference is that UnresolvedType can be used outside the context of a
ConstraintSystem, which is useful for CSGen since it sets up several of them to 
diagnose subexpressions w.r.t. their types.

For now, our use of this is extremely limited: when a closureexpr has no contextual
type available and its parameters are invalid, we wipe them out with UnresolvedType
(instead of the previous nulltype dance) to get ambiguities later on.

We also introduce a new FreeTypeVariableBinding::UnresolvedType approach for
constraint solving (and use this only in one place in CSDiags so far, to resolve
the callee of a CallExpr) which solves a system and rewrites any leftover type 
variables as UnresolvedTypes.  This allows us to get more precise information out,
for example, diagnosing:

 func r22162441(lines: [String]) {
   lines.map { line in line.fooBar() }
 }

with: value of type 'String' has no member 'fooBar'
instead of: type of expression is ambiguous without more context

This improves a number of other diagnostics as well, but is just the infrastructural
stepping stone for greater things.





Swift SVN r31130
2015-08-11 06:06:05 +00:00
Slava Pestov
08f1421a5a Import latest compiler crashers from practicalswift
68% are already fixed, including all those marked as beta 4 regressions.

Swift SVN r30914
2015-08-01 08:31:45 +00:00
Chris Lattner
4718f29742 testcase fixed by recent changes.
Swift SVN r30827
2015-07-31 00:15:43 +00:00
Slava Pestov
ccf21ff90a Revert "Sema: Fix infinite recursion when associated type default references itself"
This reverts revision r30688. The patch needs more work, because it flags a
valid case as circular, see r15054, "Relax restriction on indirectly-self-
recursive protocol conformances.  (rdar://problem/16306715)".

Swift SVN r30690
2015-07-27 06:41:10 +00:00
Slava Pestov
29d3f8f400 Sema: Fix infinite recursion when associated type default references itself
Fixes <rdar://problem/20985232>.

Swift SVN r30688
2015-07-27 05:05:05 +00:00
Slava Pestov
1a34667419 AST: Fix a couple of crashes with nested generic types
- When we walk up through parent types of 'this', we also have to walk up
  the parent contexts of 'gpContext', otherwise an assertion fires.

- getSuperclass() needs to map generic type parameters of the parent
  type even if the superclass is not generic.

Swift SVN r30676
2015-07-27 00:40:43 +00:00
Slava Pestov
7dd472686a Sema: When recursively visiting a BoundGenericType, it may not have a generic signature yet
Let the original call diagnose any problems and just return successfully
without crashing.

Swift SVN r30675
2015-07-27 00:40:41 +00:00
Slava Pestov
7bca00afc1 Sema: When adding implicit constructors, bail out if superclass is invalid
Swift SVN r30674
2015-07-27 00:40:38 +00:00