Commit Graph

1304 Commits

Author SHA1 Message Date
Chris Lattner
af8d51dabe Merge pull request #822 from practicalswift/circular-protocol-inheritance
[swiftc] Add assertion: Avoid endless loop in case of circular protocol inheritance
2016-01-01 11:18:42 -08:00
Chris Lattner
c11cbfb88c Merge pull request #827 from practicalswift/circular-class-inheritance
[swiftc] Add assertion: Avoid endless loop in case of circular class inheritance
2016-01-01 11:17:45 -08: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
practicalswift
97ef0a8b22 Sync with https://github.com/practicalswift/swift-compiler-crashes
Add 1 compiler crash (now an assertion failure, previously a hang).
2015-12-31 15:03:53 +01:00
practicalswift
5bbd02b996 Sync with https://github.com/practicalswift/swift-compiler-crashes
Add 1 compiler crash (now an assertion failure, previously a hang).
2015-12-31 05:23:01 +01:00
Dmitri Gribenko
a672828589 Annotate a crash test that depends on AppKit 2015-12-28 02:32:57 -08:00
practicalswift
48c40de31e Sync with https://github.com/practicalswift/swift-compiler-crashes
Add 2 compiler crashes (+ 1 fixed crash).
2015-12-27 19:35:50 +01:00
Max Moiseev
a7339e67ac Merge remote-tracking branch 'origin' into swift-3-api-guidelines 2015-12-22 11:36:07 -08:00
Dmitri Gribenko
b6d4abd42c Merge pull request #555 from practicalswift/memory-corruption-regression
Add 16694-swift-constraints-constraintsystem-opentype.swift as a regression (possible memory corruption)
2015-12-21 22:55:28 -08:00
Doug Gregor
cd1c106e35 Merge remote-tracking branch 'origin/master' into swift-3-api-guidelines 2015-12-18 15:45:48 -08:00
Doug Gregor
3ba3bd359b Merge pull request #620 from jtbandes/member-fix
More error checking for member type lookup
2015-12-18 10:49:06 -08:00
Doug Gregor
a97ab6dd14 Merge remote-tracking branch 'origin/master' into swift-3-api-guidelines 2015-12-18 10:15:47 -08:00
Max Moiseev
3fe0c60d7f Merge remote-tracking branch 'origin/master' into swift-3-api-guidelines 2015-12-17 11:00:02 -08:00
Jacob Bandes-Storch
ac95c1318f More error checking for member type lookup 2015-12-17 01:50:53 -08:00
Jacob Bandes-Storch
37207165f0 More error checking for subscript decls 2015-12-17 00:40:01 -08:00
Slava Pestov
d6ea5d8717 Sema: Chain all generic parameter lists
Previously, methods on DeclContext for getting generic parameters
and signatures did not walk up from type contexts to function
contexts, or function contexts to function contexts.

Presumably this is because SIL doesn't completely support nested
generics yet, instead only handling these two special cases:

- non-generic local function inside generic function
- generic method inside generic type

For local functions nested inside generic functions, SIL expects
the closure to not have an interface type or generic signature,
even if the contextual type signature contains archetypes.
This should probably be revisited some day.

Recall that these cases are explicitly rejected by Sema diagnostics
because they lack SIL support:

- generic function inside generic function
- generic type inside generic function

After the previous patches in this series, it becomes possible to
construct types that are the same as before for the supported uses of
nested generics, while introducing a more self-consistent conceptual
model for the unsupported cases.

Some new tests show we generate diagnotics in various cases that
used to crash.

The conceptual model might still not be completely right, and of
course SIL, IRGen and runtime support is still missing.
2015-12-16 11:32:56 -08:00
Max Moiseev
2021dd5a4d Merge remote-tracking branch 'origin/master' into swift-3-api-guidelines 2015-12-15 12:49:22 -08:00
practicalswift
14372cd660 Add 16694-swift-constraints-constraintsystem-opentype.swift as a regression (possible memory corruption).
History:
* Marked as fixed in the swift-compiler-crashes project in February 2015 - does not crash Xcode 6.3 beta with Swift 1.2 (6D520o).
* Re-opened as regression in December 2015 - crashes Swift version 2.2-dev (LLVM 7bae82deaa, Clang 53d04af5ce, Swift 56a62b7eef).

Possible memory corruption:

dmesg:
swift[10043]: segfault at 8 ip 000000000100e5f0 sp 00007ffca9045200 error 4 in swift[400000+3d82000]

valgrind:
==18826== Process terminating with default action of signal 11 (SIGSEGV)
==18826==  Access not within mapped region at address 0x8
==18826==    at 0x100E5F0: swift::TypeBase::getDesugaredType() (in /path/to/swift/bin/swift)
2015-12-15 09:56:12 +01:00
Slava Pestov
57dfb45ba6 Sema: Add DeclContext::isGenericTypeContext()
Once nested generic parameter lists are properly chained, we need a
way of checking if we're inside a generic type context that's
distinct from just checking if we have a generic type signature
available.

This distinguishes between these two cases:

class A<T> {
  // generic signature
  func method() -> T { // <T> A<T> -> () -> T
  }
}

func f<T>() {
  class A {
    // no generic signature
    func method() -> T { // A -> () -> T
    }
  }
}
2015-12-14 13:46:45 -08:00
Slava Pestov
c258f991f6 Sema: Nuke NominalTypeDecl::markInvalidGenericSignature()
This would just set the NominalTypeDecl's declared type to
ErrorType, which caused problems elsewhere.

Instead, generalize the logic used for AbstractFunctionDecl.
This correctly wires up the GenericTypeParamDecl's archetypes even
if the signature didn't validate, fixing crashes if the generic
parameters of the type are referenced.
2015-12-14 13:29:55 -08:00
Slava Pestov
d56cbfaaf9 Sema: Check generic parameter inheritance clause after creating archetype
This fixes a crash with invalid code where the inheritance clause
refers back to itself, eg struct E<F : F.A> {}.
2015-12-14 13:29:52 -08:00
Max Moiseev
806be29941 Merge remote-tracking branch 'origin' into swift-3-api-guidelines 2015-12-14 12:05:35 -08:00
Jacob Bandes-Storch
1b142ed054 Add missing setIsParseError() during enum case parsing
An invalid `case` construct would incorrectly return a successful status, causing `parseDecl` to crash later when it assumed there were valid decls in the `Entries` vector.
2015-12-13 13:11:22 -08:00
Chris Lattner
d12b5d0666 Merge pull request #421 from practicalswift/less-exotic-swift-frontend-arguments
Compiler crashers: Use canonical "-emit-silgen" to trigger crash case.
2015-12-12 15:11:25 -08:00
Max Moiseev
a1c05e6c95 fixing post-merge failures 2015-12-11 15:55:02 -08:00
Max Moiseev
786e1ea2b1 Merge remote-tracking branch 'origin' into swift-3-api-guidelines 2015-12-11 15:19:02 -08:00
Dmitri Gribenko
06d6dab133 Merge pull request #438 from practicalswift/sync-with-swift-compiler-crashes-20151211
Sync with https://github.com/practicalswift/swift-compiler-crashes
2015-12-11 14:42:05 -08:00
Doug Gregor
851f2eaf60 Merge pull request #272 from jtbandes/fix3
[AST] Improve ErrorType handling in TypeBase::getMemberSubstitutions()
2015-12-11 13:55:59 -08:00
Doug Gregor
53b1503a78 Merge pull request #253 from jtbandes/master
Fix crash in `DependentGenericTypeResolver::resolveDependentMemberType`
2015-12-11 13:53:01 -08:00
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