Commit Graph

112 Commits

Author SHA1 Message Date
Jordan Rose
4b87bd93f9 Tweak DiagnosticEngine's 'aka' logic to only kick in for typealiases. (#9010)
Previously we had more ad hoc logic that tried to decide if it was
worth desugaring a type based on its structure. Now we instead look
for a typealias that might actually benefit from desugaring, and if
we don't find one we won't show the 'aka' note.
2017-04-25 19:37:22 -07:00
Erik Eckstein
acca5dcfec disable a test because it times out
rdar://problem/31683781
2017-04-18 10:08:55 -07:00
Slava Pestov
8201eaaa60 SIL: Change rule regarding shared_external linkage
The existence of a shared_external function in itself is not
an error; it just means we deserialized a witness table or
vtable but did not need to deserialize a thunk.

However, a direct reference to such a function is an error,
because we should have deserialized the body in that case.

This fixes a crasher, but the SIL crashers are kind of silly
because the SIL parser does not try at all not to crash on
invalid input.
2017-03-30 00:45:20 -07:00
Slava Pestov
8fe8b89b0f SIL: Terminology change: [fragile] => [serialized]
Also, add a third [serializable] state for functions whose bodies we
*can* serialize, but only do so if they're referenced from another
serialized function.

This will be used for bodies synthesized for imported definitions,
such as init(rawValue:), etc, and various thunks, but for now this
change is NFC.
2017-03-29 16:47:28 -07:00
practicalswift
c9e534d4ea [gardening] Fix annotations for fixed crashers 2017-01-07 21:05:03 +01:00
practicalswift
724e2efa02 [gardening] Remove "REQUIRES: asserts" from fixed crashers 2017-01-06 16:38:25 +01:00
Slava Pestov
f19cbef54d Sema: Try harder not to perform lookups into tuple types 2017-01-03 23:00:07 -08:00
Slava Pestov
48c529bf3b Resolve SIL crasher which started passing at some point 2017-01-03 20:15:30 -08:00
Pavel Yaskevich
fb3515382c [Diagnostics] When checking AssignExpr properly diagnose destination
Currently if destination is unresolved instead of trying to re-typecheck
it again and diagnose structural problems which led to such outcome, it
gets completely ignored in favor of trying to type-check source without
contextual type. That leads to missed diagnostic opportunities, which
results in problems on AST verification and SIL generation stages, and
generally missleading errors e.g. `.x = 0`.

Resolves: SR-3506.
2017-01-03 18:22:33 -08:00
practicalswift
f5f7064eb9 [gardening] Remove asserts from fixed crashers. 2016-12-21 21:17:06 +01:00
Slava Pestov
09dd5fec84 Sema: Small fixes 2016-12-21 14:20:27 -05:00
Mishal Shah
91822ee424 Revert "Disable tests until PR bots logging issue on Linux is fixed." 2016-12-21 12:05:03 +05:30
Michael Gottesman
3efa19fb93 Disable tests until PR bots logging issue on Linux is fixed. 2016-12-17 19:33:02 -08:00
practicalswift
a3ccac27db [gardening] Remove "REQUIRES: asserts" from fixed crashers. 2016-12-11 00:50:26 +01:00
Slava Pestov
e063e8297c Sema: Some fixes for the ITC
- In functions called from resolveType(), consistently
  use a Type() return value to indicate 'unsatisfied
  dependency', and ErrorType to indicate failure.

- Plumb the unsatisfiedDependency callback through the
  resolution of the arguments of BoundGenericTypes, and
  also pass down the options.

- Before doing a conformance check on the argument of a
  BoundGenericType, kick off a TypeCheckSuperclass request
  if the type in question is a class. This ensures we don't
  recurse through NominalTypeDecl::prepareConformanceTable(),
  which wants to see a class with a valid superclass.

- The ResolveTypeOfDecl request was assuming that
  the request was satisfied after calling validateDecl().
  This is not the case when the ITC is invoked from a
  recursive call to validateDecl(), hack this up by returning
  *true* from isResolveTypeDeclSatisfied(); otherwise we
  assert in satisfy(), and we can't make forward progress
  in this case anyway.

- Fix a bug in cycle breaking; it seems if we don't invoke
  the cycle break callback on all pending requests, we end
  up looping forever in an outer call to satisfy().

- Remove unused TR_GlobalTypeAlias option.
2016-12-09 17:36:49 -08:00
Jordan Rose
49e6c06eef [validation-test] Remove "REQUIRES: asserts" from /fixed/ crash cases. (#6156) 2016-12-08 19:06:32 -08:00
Joe Groff
277608a69b Print and parse SILBoxTypes with a new syntax.
Use a syntax that declares the layout's generic parameters and fields,
followed by the generic arguments to apply to the layout:

  { var Int, let String } // A concrete box layout with a mutable Int
                          // and immutable String field
  <T, U> { var T, let U } <Int, String> // A generic box layout,
                                        // applied to Int and String
                                        // arguments
2016-12-02 13:44:22 -08:00
Slava Pestov
37d38abeb1 AST: Fix crashes when ordering potential archetypes arising from typealias declarations in protocols
This fixes the oldest compiler crasher, number 46. All remaining unfixed
crashers are numbered 28155 and above.
2016-11-27 04:02:43 -08:00
Slava Pestov
ea28765ced Sema: Resolve invalid generic parameters to error types
When a generic parameter list fails to parse, we don't call
DeclContext::setGenericParams(), even though the generic
parameters are still available for name lookup.

This causes various crashes, which this patch fixes by
mapping the generic parameters to ErrorTypes.
2016-11-26 01:31:59 -05:00
Rintaro Ishizaki
a1760161c5 [Parse] Don't parse 'throws' or 'rethrows' as identifiers
It seems there is no reason to accept them.
Why we want to accept `class C<throws> { ... }`?
2016-11-24 10:55:24 +09:00
Andrew Trick
1aa9021b7d Disable -enable-sil-verify-all in stdlib parsing tests.
See <rdar://problem/24060338> Identify problems with textual SIL and fix them

This was never working, but does seem to have recently been fixed on OSX.

It's still failing on Linux:

SIL verification failed: vtable entry for #_AnySequenceBox._prefix!1 must be ABI-compatible
Different conventions for parameter 0
  @convention(method) <τ_0_0> (Int, @guaranteed _AnySequenceBox<τ_0_0>) -> @owned _AnySequenceBox<τ_0_0>
    @convention(method) <τ_0_0> (@owned @callee_owned (@in τ_0_0) -> (Bool, @error Error), @guaranteed _AnySequenceBox<τ_0_0>) -> (@owned _AnySequenceBox<τ_0_0>, @error Error)
    In function:
2016-11-18 12:35:57 -08:00
Rintaro Ishizaki
1b51bc1d6b [Sema] Check existence of GenericSignature before getting GenericParamList from it
Fixes 2 compiler crasher.
2016-11-14 22:01:53 +09:00
Michael Gottesman
20dd563efb [semantic-arc] Update tests for qualified/unqualified ownership and SILGen emission of copy_value, destroy_value. 2016-10-29 20:11:09 -07:00
Rintaro Ishizaki
8a9c8d579f [Parse] isNonNull() check before constructing InOutTypeRepr (#5361)
Fixes 2 compiler crashers
2016-10-20 08:18:00 +09:00
practicalswift
e04af606d4 [SIL] Add test case for crash triggered in swift::Parser::parseTypeSimpleOrComposition(swift::Diag<>, bool)
Stack trace:

```
<stdin>:3:1: error: statement cannot begin with a closure expression
{struct R{func o:inout p<
^
<stdin>:3:1: note: explicitly discard the result of the closure by assigning to '_'
{struct R{func o:inout p<
^
_ =
<stdin>:3:17: error: expected '(' in argument list of function declaration
{struct R{func o:inout p<
                ^
<stdin>:3:17: error: expected '->' after function parameter tuple
{struct R{func o:inout p<
                ^
                 ->
<stdin>:3:26: error: expected type
{struct R{func o:inout p<
                         ^
sil-opt: /path/to/swift/include/swift/Parse/ParserResult.h:73: T *swift::ParserResult<swift::TypeRepr>::get() const [T = swift::TypeRepr]: Assertion `getPtrOrNull() && "not checked for nullptr"' failed.
8  sil-opt         0x0000000000b22bdd swift::Parser::parseTypeSimpleOrComposition(swift::Diag<>, bool) + 29
9  sil-opt         0x0000000000b22844 swift::Parser::parseType(swift::Diag<>, bool) + 212
10 sil-opt         0x0000000000b58ea0 swift::Parser::parseFunctionSignature(swift::Identifier, swift::DeclName&, llvm::SmallVectorImpl<swift::ParameterList*>&, swift::Parser::DefaultArgumentInfo&, swift::SourceLoc&, bool&, swift::TypeRepr*&) + 1232
11 sil-opt         0x0000000000b3cab5 swift::Parser::parseDeclFunc(swift::SourceLoc, swift::StaticSpellingKind, swift::OptionSet<swift::Parser::ParseDeclFlags, unsigned int>, swift::DeclAttributes&) + 3781
12 sil-opt         0x0000000000b30e97 swift::Parser::parseDecl(swift::OptionSet<swift::Parser::ParseDeclFlags, unsigned int>, llvm::function_ref<void (swift::Decl*)>) + 2983
14 sil-opt         0x0000000000adc44c swift::Parser::parseList(swift::tok, swift::SourceLoc, swift::SourceLoc&, swift::tok, bool, bool, swift::Diag<>, std::function<swift::ParserStatus ()>) + 348
15 sil-opt         0x0000000000b38865 swift::Parser::parseDeclStruct(swift::OptionSet<swift::Parser::ParseDeclFlags, unsigned int>, swift::DeclAttributes&) + 1861
16 sil-opt         0x0000000000b30f82 swift::Parser::parseDecl(swift::OptionSet<swift::Parser::ParseDeclFlags, unsigned int>, llvm::function_ref<void (swift::Decl*)>) + 3218
17 sil-opt         0x0000000000b12d79 swift::Parser::parseBraceItems(llvm::SmallVectorImpl<swift::ASTNode>&, swift::BraceItemListKind, swift::BraceItemListKind) + 889
18 sil-opt         0x0000000000b50af2 swift::Parser::parseExprClosure() + 962
19 sil-opt         0x0000000000b49635 swift::Parser::parseExprPostfix(swift::Diag<>, bool) + 2853
20 sil-opt         0x0000000000b488fd swift::Parser::parseExprUnary(swift::Diag<>, bool) + 509
21 sil-opt         0x0000000000b481f1 swift::Parser::parseExprSequenceElement(swift::Diag<>, bool) + 97
22 sil-opt         0x0000000000b4738e swift::Parser::parseExprSequence(swift::Diag<>, bool, bool) + 158
23 sil-opt         0x0000000000b47247 swift::Parser::parseExprImpl(swift::Diag<>, bool) + 151
24 sil-opt         0x0000000000b11486 swift::Parser::parseExprOrStmt(swift::ASTNode&) + 422
25 sil-opt         0x0000000000b13140 swift::Parser::parseBraceItems(llvm::SmallVectorImpl<swift::ASTNode>&, swift::BraceItemListKind, swift::BraceItemListKind) + 1856
26 sil-opt         0x0000000000b26cea swift::Parser::parseTopLevel() + 170
27 sil-opt         0x0000000000ad8d40 swift::parseIntoSourceFile(swift::SourceFile&, unsigned int, bool*, swift::SILParserState*, swift::PersistentParserState*, swift::DelayedParsingCallbacks*) + 208
28 sil-opt         0x00000000008021e3 swift::CompilerInstance::performSema() + 3315
29 sil-opt         0x00000000007e8d3c main + 1852
Stack dump:
0.	Program arguments: sil-opt -enable-sil-verify-all
1.	With parser at source location: <stdin>:3:26
```
2016-10-19 09:21:29 +02:00
practicalswift
a39cd70083 [SIL] Add test case for crash triggered in swift::Parser::parseIdentifier(swift::Identifier&, swift::SourceLoc&, swift::Diagnostic const&)
Stack trace:

```
sil-opt: /path/to/swift/include/swift/Parse/Parser.h:393: swift::SourceLoc swift::Parser::consumeIdentifier(swift::Identifier *): Assertion `Tok.isAny(tok::identifier, tok::kw_self, tok::kw_Self, tok::kw_throws)' failed.
8  sil-opt         0x0000000000ada58e swift::Parser::parseIdentifier(swift::Identifier&, swift::SourceLoc&, swift::Diagnostic const&) + 78
9  sil-opt         0x0000000000b54d5a swift::Parser::parseGenericParameters(swift::SourceLoc) + 570
10 sil-opt         0x0000000000b55bf4 swift::Parser::maybeParseGenericParams() + 132
11 sil-opt         0x0000000000b318ea swift::Parser::parseDeclClass(swift::SourceLoc, swift::OptionSet<swift::Parser::ParseDeclFlags, unsigned int>, swift::DeclAttributes&) + 954
12 sil-opt         0x0000000000b2f97d swift::Parser::parseDecl(swift::OptionSet<swift::Parser::ParseDeclFlags, unsigned int>, llvm::function_ref<void (swift::Decl*)>) + 3901
13 sil-opt         0x0000000000b118a9 swift::Parser::parseBraceItems(llvm::SmallVectorImpl<swift::ASTNode>&, swift::BraceItemListKind, swift::BraceItemListKind) + 889
14 sil-opt         0x0000000000b2543a swift::Parser::parseTopLevel() + 170
15 sil-opt         0x0000000000ad8360 swift::parseIntoSourceFile(swift::SourceFile&, unsigned int, bool*, swift::SILParserState*, swift::PersistentParserState*, swift::DelayedParsingCallbacks*) + 208
16 sil-opt         0x0000000000802013 swift::CompilerInstance::performSema() + 3315
17 sil-opt         0x00000000007e8b5c main + 1852
Stack dump:
0.	Program arguments: sil-opt -enable-sil-verify-all
1.	With parser at source location: <stdin>:3:9
```
2016-10-13 19:19:31 +02:00
practicalswift
f34c862c61 [SIL] Add test case for crash triggered in swift::Parser::parseSILCoverageMap()
Stack trace:

```
<stdin>:3:26: error: expected SIL value name
sil_default_witness_table
                         ^
sil-opt: /path/to/swift/include/swift/Parse/Parser.h:388: swift::SourceLoc swift::Parser::consumeToken(swift::tok): Assertion `Tok.is(K) && "Consuming wrong token kind"' failed.
7  sil-opt         0x0000000000ae77a0 swift::Parser::parseSILCoverageMap() + 0
8  sil-opt         0x0000000000b257cb swift::Parser::parseTopLevel() + 811
9  sil-opt         0x0000000000ad8550 swift::parseIntoSourceFile(swift::SourceFile&, unsigned int, bool*, swift::SILParserState*, swift::PersistentParserState*, swift::DelayedParsingCallbacks*) + 208
10 sil-opt         0x0000000000801cd3 swift::CompilerInstance::performSema() + 3315
11 sil-opt         0x00000000007e883c main + 1852
Stack dump:
0.	Program arguments: sil-opt -enable-sil-verify-all
1.	With parser at source location: <stdin>:3:26
```
2016-10-11 13:27:31 +02:00
Rintaro Ishizaki
e52e043d57 [Parse] Don't use tok::unknown as a dummy token (#5171)
Use tok::NUM_TOKENS instead. tok::unknown can easily appear in source code.

For instance `skipUntil(tok::eof)` did not work as expected, because that was
`skipUntil(tok::eof, tok::unknown)` hence does stop at error tokens such as
`0xG` (invalid hex number literal).

Revert 2abc92bbb5, since that was
accidental side-effect of 45118037cc.
Forward references are not allowed actually.
2016-10-07 14:37:11 +09:00
practicalswift
1749169810 [SIL] Add test case for crash triggered in swift::DerivedConformance::deriveRawRepresentable(swift::TypeChecker&, swift::Decl*, swift::NominalTypeDecl*, swift::AssociatedTypeDecl*)
Stack trace:

```
<stdin>:4:9: error: expected '>' to complete generic parameter list
func d<T{enum a:T
        ^
<stdin>:4:7: note: to match this opening '<'
func d<T{enum a:T
      ^
<stdin>:4:9: error: expected '(' in argument list of function declaration
func d<T{enum a:T
        ^
<stdin>:4:18: error: expected '{' in enum
func d<T{enum a:T
                 ^
<stdin>:4:18: error: expected '}' at end of brace statement
func d<T{enum a:T
                 ^
<stdin>:4:9: note: to match this opening '{'
func d<T{enum a:T
        ^
<stdin>:4:17: error: raw type 'T' is not expressible by any literal
func d<T{enum a:T
                ^
sil-opt: /path/to/swift/lib/AST/ArchetypeBuilder.cpp:1991: static swift::Type swift::ArchetypeBuilder::mapTypeIntoContext(swift::ModuleDecl *, swift::GenericEnvironment *, swift::Type): Assertion `env && "dependent type in non-generic context"' failed.
9  sil-opt         0x0000000000c8d219 swift::DerivedConformance::deriveRawRepresentable(swift::TypeChecker&, swift::Decl*, swift::NominalTypeDecl*, swift::AssociatedTypeDecl*) + 57
12 sil-opt         0x0000000000bc663b swift::TypeChecker::checkConformance(swift::NormalProtocolConformance*) + 1611
13 sil-opt         0x0000000000bc6d35 swift::TypeChecker::checkConformancesInContext(swift::DeclContext*, swift::IterableDeclContext*) + 485
16 sil-opt         0x0000000000b7c216 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 150
19 sil-opt         0x0000000000be7a53 swift::TypeChecker::typeCheckFunctionBodyUntil(swift::FuncDecl*, swift::SourceLoc) + 355
20 sil-opt         0x0000000000be78a7 swift::TypeChecker::typeCheckAbstractFunctionBodyUntil(swift::AbstractFunctionDecl*, swift::SourceLoc) + 39
21 sil-opt         0x0000000000be84ac swift::TypeChecker::typeCheckAbstractFunctionBody(swift::AbstractFunctionDecl*) + 188
23 sil-opt         0x0000000000ba2abb swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) + 1291
24 sil-opt         0x0000000000801956 swift::CompilerInstance::performSema() + 3350
25 sil-opt         0x00000000007e84bc main + 1852
Stack dump:
0.	Program arguments: sil-opt -enable-sil-verify-all
1.	While type-checking 'd' at <stdin>:4:1
2.	While type-checking 'a' at <stdin>:4:10
```
2016-10-06 22:52:40 +02:00
practicalswift
54f606b1d5 [SIL] Add test case for crash triggered in swift::Parser::parseTopLevel()
Stack trace:

```
<stdin>:3:9: error: expected '{' in class
class a 4{sil_vtable a
        ^
<stdin>:3:10: error: statement cannot begin with a closure expression
class a 4{sil_vtable a
         ^
<stdin>:3:10: note: explicitly discard the result of the closure by assigning to '_'
class a 4{sil_vtable a
         ^
         _ =
<stdin>:3:11: error: expected '}' at end of closure
class a 4{sil_vtable a
          ^
<stdin>:3:10: note: to match this opening '{'
class a 4{sil_vtable a
         ^
<stdin>:3:10: error: expressions are not allowed at the top level
class a 4{sil_vtable a
         ^
<stdin>:3:10: error: braced block of statements is an unused closure
class a 4{sil_vtable a
         ^
<stdin>:3:10: error: expression resolves to an unused function
class a 4{sil_vtable a
         ^
sil-opt: /path/to/swift/include/swift/Parse/Parser.h:388: swift::SourceLoc swift::Parser::consumeToken(swift::tok): Assertion `Tok.is(K) && "Consuming wrong token kind"' failed.
8  sil-opt         0x0000000000b23aa3 swift::Parser::parseTopLevel() + 739
9  sil-opt         0x0000000000ad68e0 swift::parseIntoSourceFile(swift::SourceFile&, unsigned int, bool*, swift::SILParserState*, swift::PersistentParserState*, swift::DelayedParsingCallbacks*) + 208
10 sil-opt         0x0000000000801933 swift::CompilerInstance::performSema() + 3315
11 sil-opt         0x00000000007e84bc main + 1852
Stack dump:
0.	Program arguments: sil-opt -enable-sil-verify-all
1.	With parser at source location: <stdin>:3:23
```
2016-10-06 20:15:34 +02:00
practicalswift
4125912ea6 [SIL] Add test case for crash triggered in swift::TypeBase::getDesugaredType()
Stack trace:

```
<stdin>:3:9: error: expected '{' in class
class C struct A{weak var e:C
        ^
<stdin>:3:30: error: consecutive declarations on a line must be separated by ';'
class C struct A{weak var e:C
                             ^
                             ;
<stdin>:3:30: error: expected declaration
class C struct A{weak var e:C
                             ^
<stdin>:3:16: note: in declaration of 'A'
class C struct A{weak var e:C
               ^
sil-opt: /path/to/swift/lib/AST/Type.cpp:1368: swift::Type swift::SyntaxSugarType::getImplementationType(): Assertion `implDecl && "Optional type has not been set yet"' failed.
8  sil-opt         0x0000000000eada7f swift::TypeBase::getDesugaredType() + 15
10 sil-opt         0x0000000000e6796c swift::DiagnosticEngine::emitDiagnostic(swift::Diagnostic const&) + 2364
11 sil-opt         0x0000000000e66e11 swift::DiagnosticEngine::flushActiveDiagnostic() + 305
12 sil-opt         0x0000000000cab5b1 swift::TypeChecker::checkOwnershipAttr(swift::VarDecl*, swift::OwnershipAttr*) + 321
13 sil-opt         0x0000000000cab282 swift::TypeChecker::checkTypeModifyingDeclAttributes(swift::VarDecl*) + 82
14 sil-opt         0x0000000000bc0506 swift::TypeChecker::coercePatternToType(swift::Pattern*&, swift::DeclContext*, swift::Type, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, swift::GenericTypeResolver*, swift::TypeLoc) + 1926
15 sil-opt         0x0000000000bbfcae swift::TypeChecker::typeCheckPattern(swift::Pattern*, swift::DeclContext*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, swift::GenericTypeResolver*) + 1070
17 sil-opt         0x0000000000b762b5 swift::TypeChecker::validateDecl(swift::ValueDecl*, bool) + 1973
18 sil-opt         0x0000000000c020f6 swift::createImplicitConstructor(swift::TypeChecker&, swift::NominalTypeDecl*, swift::ImplicitConstructorKind) + 422
19 sil-opt         0x0000000000b81778 swift::TypeChecker::addImplicitConstructors(swift::NominalTypeDecl*) + 1384
22 sil-opt         0x0000000000b7c216 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 150
23 sil-opt         0x0000000000ba29cf swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) + 1055
24 sil-opt         0x0000000000801956 swift::CompilerInstance::performSema() + 3350
25 sil-opt         0x00000000007e84bc main + 1852
Stack dump:
0.	Program arguments: sil-opt -enable-sil-verify-all
1.	While type-checking 'A' at <stdin>:3:9
```
2016-10-06 16:36:45 +02:00
practicalswift
7a8053587e [SIL] Add test case for crash triggered in swift::IterativeTypeChecker::processResolveTypeDecl(swift::TypeDecl*, llvm::function_ref<bool (swift::TypeCheckRequest)>)
Stack trace:

```
<stdin>:3:11: error: expected '{' in struct
struct I:b:typealias b:a
          ^
<stdin>:3:23: error: expected '=' in typealias declaration
struct I:b:typealias b:a
                      ^
                       =
sil-opt: /path/to/swift/include/swift/AST/Decl.h:2062: swift::Accessibility swift::ValueDecl::getFormalAccess(const swift::DeclContext *) const: Assertion `hasAccessibility() && "accessibility not computed yet"' failed.
8  sil-opt         0x0000000000c3ea24 swift::IterativeTypeChecker::processResolveTypeDecl(swift::TypeDecl*, llvm::function_ref<bool (swift::TypeCheckRequest)>) + 356
9  sil-opt         0x0000000000c14bed swift::IterativeTypeChecker::satisfy(swift::TypeCheckRequest) + 493
10 sil-opt         0x0000000000c14d79 swift::IterativeTypeChecker::satisfy(swift::TypeCheckRequest) + 889
13 sil-opt         0x0000000000af3d62 swift::TypeChecker::validateDecl(swift::ValueDecl*, bool) + 3394
17 sil-opt         0x0000000000b6d122 swift::TypeChecker::resolveIdentifierType(swift::DeclContext*, swift::IdentTypeRepr*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, bool, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 162
19 sil-opt         0x0000000000b6e1c4 swift::TypeChecker::resolveType(swift::TypeRepr*, swift::DeclContext*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 164
20 sil-opt         0x0000000000b6c953 swift::TypeChecker::validateType(swift::TypeLoc&, swift::DeclContext*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 195
21 sil-opt         0x0000000000af1b0a swift::TypeChecker::checkInheritanceClause(swift::Decl*, swift::GenericTypeResolver*) + 5274
22 sil-opt         0x0000000000af3197 swift::TypeChecker::validateDecl(swift::ValueDecl*, bool) + 375
25 sil-opt         0x0000000000af99b6 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 150
26 sil-opt         0x0000000000b1f362 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) + 1026
27 sil-opt         0x00000000007758a9 swift::CompilerInstance::performSema() + 3289
28 sil-opt         0x000000000075ec65 main + 1813
Stack dump:
0.	Program arguments: sil-opt -enable-sil-verify-all
1.	While type-checking 'I' at <stdin>:3:1
2.	While resolving type b at [<stdin>:3:10 - line:3:10] RangeText="b"
3.	While type-checking 'b' at <stdin>:3:12
```
2016-09-30 21:37:20 +02:00
practicalswift
d870880c17 [SIL] Add test case for crash triggered in llvm::llvm_unreachable_internal(char const*, char const*, unsigned int)
Stack trace:

```
<stdin>:3:11: error: expected '{' in protocol type
protocol a
          ^
<stdin>:6:1: error: typealias is missing an assigned type; use 'associatedtype' to define an associated type requirement
typealias b
^~~~~~~~~
associatedtype
<stdin>:6:12: error: consecutive declarations on a line must be separated by ';'
typealias b
           ^
           ;
<stdin>:6:12: error: expected declaration
typealias b
           ^
<stdin>:4:10: note: in declaration of 'a'
protocol a{typealias b=a
         ^
<stdin>:4:24: error: 'a' is ambiguous for type lookup in this context
protocol a{typealias b=a
                       ^
<stdin>:3:10: note: found this candidate
protocol a
         ^
<stdin>:4:10: note: found this candidate
protocol a{typealias b=a
         ^
<stdin>:5:13: error: use of undeclared type 'c'
typealias b=c
            ^
potential archetype total order failure
UNREACHABLE executed at /path/to/swift/lib/AST/ArchetypeBuilder.cpp:1122!
6  sil-opt         0x000000000309743d llvm::llvm_unreachable_internal(char const*, char const*, unsigned int) + 461
9  libc.so.6       0x00007f30b0e516cc qsort_r + 652
10 sil-opt         0x0000000000d4c2f3 swift::ArchetypeBuilder::enumerateRequirements(llvm::function_ref<void (swift::RequirementKind, swift::ArchetypeBuilder::PotentialArchetype*, llvm::PointerUnion<swift::Type, swift::ArchetypeBuilder::PotentialArchetype*>, swift::RequirementSource)>) + 883
11 sil-opt         0x0000000000d4d248 swift::ArchetypeBuilder::getGenericSignature(llvm::ArrayRef<swift::GenericTypeParamType*>) + 72
12 sil-opt         0x0000000000b3634c swift::TypeChecker::validateGenericSignature(swift::GenericParamList*, swift::DeclContext*, swift::GenericSignature*, std::function<bool (swift::ArchetypeBuilder&)>, bool&) + 300
13 sil-opt         0x0000000000b36d4e swift::TypeChecker::validateGenericTypeSignature(swift::GenericTypeDecl*) + 126
14 sil-opt         0x0000000000af3746 swift::TypeChecker::validateDecl(swift::ValueDecl*, bool) + 1830
16 sil-opt         0x0000000000af99b6 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 150
17 sil-opt         0x0000000000b1f362 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) + 1026
18 sil-opt         0x00000000007758a9 swift::CompilerInstance::performSema() + 3289
19 sil-opt         0x000000000075ec65 main + 1813
Stack dump:
0.	Program arguments: sil-opt -enable-sil-verify-all
1.	While type-checking 'a' at <stdin>:3:1
```
2016-09-25 17:07:32 +02:00
practicalswift
d5a9b73564 [SIL] Add test case for crash triggered in swift::SourceFile::LookupCache::lookupClassMembers(llvm::ArrayRef<std::pair<swift::Identifier, swift::SourceLoc> >, swift::VisibleDeclConsumer&, swift::SourceFile const&)
Stack trace:

```
<stdin>:3:1: error: statement cannot begin with a closure expression
{
^
<stdin>:3:1: note: explicitly discard the result of the closure by assigning to '_'
{
^
_ =
<stdin>:4:3: error: consecutive statements on a line must be separated by ';'
()AnyObject
  ^
  ;
<stdin>:3:1: error: expressions are not allowed at the top level
{
^
<stdin>:3:1: error: braced block of statements is an unused closure
{
^
<stdin>:8:22: error: unnamed parameters must be written with the empty name '_'
class b{@objc func a(c)
                     ^
                     _:
<stdin>:8:24: error: consecutive declarations on a line must be separated by ';'
class b{@objc func a(c)
                       ^
                       ;
<stdin>:8:24: error: expected declaration
class b{@objc func a(c)
                       ^
<stdin>:8:7: note: in declaration of 'b'
class b{@objc func a(c)
      ^
<stdin>:8:22: error: use of undeclared type 'c'
class b{@objc func a(c)
                     ^
sil-opt: /path/to/llvm/include/llvm/Support/Casting.h:237: typename cast_retty<X, Y *>::ret_type llvm::cast(Y *) [X = swift::AnyFunctionType, Y = swift::TypeBase]: Assertion `isa<X>(Val) && "cast<Ty>() argument of incompatible type!"' failed.
9  sil-opt         0x0000000000e51dd3 swift::SourceFile::LookupCache::lookupClassMembers(llvm::ArrayRef<std::pair<swift::Identifier, swift::SourceLoc> >, swift::VisibleDeclConsumer&, swift::SourceFile const&) + 787
10 sil-opt         0x0000000000e532a2 swift::ModuleDecl::lookupClassMembers(llvm::ArrayRef<std::pair<swift::Identifier, swift::SourceLoc> >, swift::VisibleDeclConsumer&) const + 50
12 sil-opt         0x0000000000e582ed swift::ModuleDecl::forAllVisibleModules(llvm::ArrayRef<std::pair<swift::Identifier, swift::SourceLoc> >, bool, llvm::function_ref<bool (std::pair<llvm::ArrayRef<std::pair<swift::Identifier, swift::SourceLoc> >, swift::ModuleDecl*>)>) + 477
13 sil-opt         0x0000000000e58461 swift::FileUnit::forAllVisibleModules(llvm::function_ref<bool (std::pair<llvm::ArrayRef<std::pair<swift::Identifier, swift::SourceLoc> >, swift::ModuleDecl*>)>) + 81
17 sil-opt         0x0000000000b3a51b swift::TypeChecker::performTypoCorrection(swift::DeclContext*, swift::DeclRefKind, swift::Type, swift::DeclName, swift::SourceLoc, swift::OptionSet<swift::NameLookupFlags, unsigned int>, swift::LookupResult&, unsigned int) + 267
19 sil-opt         0x0000000000bb1773 swift::constraints::ConstraintSystem::diagnoseFailureForExpr(swift::Expr*) + 2899
20 sil-opt         0x0000000000bb750e swift::constraints::ConstraintSystem::salvage(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::Expr*) + 4078
21 sil-opt         0x0000000000adf6f7 swift::TypeChecker::solveForExpression(swift::Expr*&, swift::DeclContext*, swift::Type, swift::FreeTypeVariableBinding, swift::ExprTypeCheckListener*, swift::constraints::ConstraintSystem&, llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>) + 471
22 sil-opt         0x0000000000ae2dd5 swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*, swift::constraints::ConstraintSystem*) + 949
25 sil-opt         0x0000000000b66b94 swift::TypeChecker::typeCheckClosureBody(swift::ClosureExpr*) + 244
26 sil-opt         0x0000000000b93f5c swift::constraints::ConstraintSystem::applySolution(swift::constraints::Solution&, swift::Expr*, swift::Type, bool, bool, bool) + 876
27 sil-opt         0x0000000000ae2e86 swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*, swift::constraints::ConstraintSystem*) + 1126
29 sil-opt         0x0000000000b66cd6 swift::TypeChecker::typeCheckTopLevelCodeDecl(swift::TopLevelCodeDecl*) + 134
30 sil-opt         0x0000000000b1f3cd swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) + 1133
31 sil-opt         0x00000000007758a9 swift::CompilerInstance::performSema() + 3289
32 sil-opt         0x000000000075ec65 main + 1813
Stack dump:
0.	Program arguments: sil-opt -enable-sil-verify-all
1.	While type-checking expression at [<stdin>:3:1 - line:6:1] RangeText="{
()AnyObject
.n
}"
2.	While type-checking expression at [<stdin>:4:3 - line:5:2] RangeText="AnyObject
.n"
```
2016-09-23 11:22:42 +02:00
practicalswift
47e31d5439 [SIL] Add test case for crash triggered in llvm::llvm_unreachable_internal(char const*, char const*, unsigned int)
Stack trace:

```
<stdin>:3:9: error: expected '>' to complete generic parameter list
func l<X{weak var c:X
        ^
<stdin>:3:7: note: to match this opening '<'
func l<X{weak var c:X
      ^
<stdin>:3:9: error: expected '(' in argument list of function declaration
func l<X{weak var c:X
        ^
<stdin>:3:22: error: expected '}' at end of brace statement
func l<X{weak var c:X
                     ^
<stdin>:3:9: note: to match this opening '{'
func l<X{weak var c:X
        ^
Dependent types can't answer reference-semantics query
UNREACHABLE executed at /path/to/swift/lib/AST/Type.cpp:174!
6  sil-opt         0x000000000309743d llvm::llvm_unreachable_internal(char const*, char const*, unsigned int) + 461
7  sil-opt         0x0000000000e77e13 swift::CanType::isReferenceTypeImpl(swift::CanType, bool) + 419
8  sil-opt         0x0000000000c2f52e swift::TypeChecker::checkOwnershipAttr(swift::VarDecl*, swift::OwnershipAttr*) + 190
9  sil-opt         0x0000000000c2f27c swift::TypeChecker::checkTypeModifyingDeclAttributes(swift::VarDecl*) + 76
10 sil-opt         0x0000000000b3dc8c swift::TypeChecker::coercePatternToType(swift::Pattern*&, swift::DeclContext*, swift::Type, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, swift::GenericTypeResolver*, swift::TypeLoc) + 2076
11 sil-opt         0x0000000000b3d391 swift::TypeChecker::typeCheckPattern(swift::Pattern*, swift::DeclContext*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, swift::GenericTypeResolver*) + 1041
14 sil-opt         0x0000000000af99b6 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 150
17 sil-opt         0x0000000000b6597a swift::TypeChecker::typeCheckFunctionBodyUntil(swift::FuncDecl*, swift::SourceLoc) + 346
18 sil-opt         0x0000000000b657de swift::TypeChecker::typeCheckAbstractFunctionBodyUntil(swift::AbstractFunctionDecl*, swift::SourceLoc) + 46
19 sil-opt         0x0000000000b663b3 swift::TypeChecker::typeCheckAbstractFunctionBody(swift::AbstractFunctionDecl*) + 179
21 sil-opt         0x0000000000b1f461 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) + 1281
22 sil-opt         0x00000000007758a9 swift::CompilerInstance::performSema() + 3289
23 sil-opt         0x000000000075ec65 main + 1813
Stack dump:
0.	Program arguments: sil-opt -enable-sil-verify-all
1.	While type-checking 'l' at <stdin>:3:1
2.	While type-checking declaration 0x5752658 at <stdin>:3:15
```
2016-09-20 10:24:11 +02:00
practicalswift
8b3830773c [SIL] Add test case for crash triggered in swift::TypeBase::getCanonicalType()
Stack trace:

```
<stdin>:3:16: warning: operator '<' declared in protocol must be 'static'
protocol f{func<extension{func<
               ^
           static
<stdin>:3:17: error: expected '(' in argument list of function declaration
protocol f{func<extension{func<
                ^
<stdin>:3:17: error: consecutive declarations on a line must be separated by ';'
protocol f{func<extension{func<
                ^
                ;
<stdin>:3:26: error: expected type name in extension declaration
protocol f{func<extension{func<
                         ^
<stdin>:3:32: error: expected '(' in argument list of function declaration
protocol f{func<extension{func<
                               ^
<stdin>:3:32: error: expected declaration
protocol f{func<extension{func<
                               ^
<stdin>:3:17: error: declaration is only valid at file scope
protocol f{func<extension{func<
                ^
<stdin>:3:32: error: consecutive declarations on a line must be separated by ';'
protocol f{func<extension{func<
                               ^
                               ;
<stdin>:3:32: error: expected declaration
protocol f{func<extension{func<
                               ^
<stdin>:3:10: note: in declaration of 'f'
protocol f{func<extension{func<
         ^
<stdin>:3:16: error: operators must have one or two arguments
protocol f{func<extension{func<
               ^
<stdin>:3:16: error: member operator '<()' of protocol 'f' must have at least one argument of type 'Self'
protocol f{func<extension{func<
               ^
<stdin>:3:31: error: operator '<' declared in type '<<error type>>' must be 'static'
protocol f{func<extension{func<
                              ^
                          static
<stdin>:3:31: error: operators must have one or two arguments
protocol f{func<extension{func<
                              ^
4  sil-opt         0x0000000000e76f54 swift::TypeBase::getCanonicalType() + 20
5  sil-opt         0x0000000000e21744 swift::ExtensionDecl::isConstrainedExtension() const + 20
7  sil-opt         0x0000000000b46e40 swift::TypeChecker::inferDefaultWitnesses(swift::ProtocolDecl*) + 288
8  sil-opt         0x0000000000b1fa68 swift::finishTypeChecking(swift::SourceFile&) + 536
9  sil-opt         0x0000000000775a5a swift::CompilerInstance::performSema() + 3722
10 sil-opt         0x000000000075ec65 main + 1813
Stack dump:
0.	Program arguments: sil-opt -enable-sil-verify-all
```
2016-09-19 11:24:28 +02:00
practicalswift
a807e6de56 [SIL] Add test case for crash triggered in llvm::llvm_unreachable_internal(char const*, char const*, unsigned int)
Stack trace:

```
<stdin>:3:1: error: expressions are not allowed at the top level
.x.a=Int
^
not an l-value
UNREACHABLE executed at /path/to/swift/include/swift/AST/ExprNodes.def:79!
6  sil-opt         0x000000000309743d llvm::llvm_unreachable_internal(char const*, char const*, unsigned int) + 461
8  sil-opt         0x0000000000e39837 swift::Expr::propagateLValueAccessKind(swift::AccessKind, bool) + 23
12 sil-opt         0x0000000000dc250c swift::Expr::walk(swift::ASTWalker&) + 108
13 sil-opt         0x0000000000b93df2 swift::constraints::ConstraintSystem::applySolution(swift::constraints::Solution&, swift::Expr*, swift::Type, bool, bool, bool) + 514
14 sil-opt         0x0000000000ae2e86 swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*, swift::constraints::ConstraintSystem*) + 1126
17 sil-opt         0x0000000000bb2a17 swift::constraints::ConstraintSystem::diagnoseFailureForExpr(swift::Expr*) + 7671
18 sil-opt         0x0000000000bb750e swift::constraints::ConstraintSystem::salvage(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::Expr*) + 4078
19 sil-opt         0x0000000000adf6f7 swift::TypeChecker::solveForExpression(swift::Expr*&, swift::DeclContext*, swift::Type, swift::FreeTypeVariableBinding, swift::ExprTypeCheckListener*, swift::constraints::ConstraintSystem&, llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>) + 471
20 sil-opt         0x0000000000ae2dd5 swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*, swift::constraints::ConstraintSystem*) + 949
22 sil-opt         0x0000000000b66cd6 swift::TypeChecker::typeCheckTopLevelCodeDecl(swift::TopLevelCodeDecl*) + 134
23 sil-opt         0x0000000000b1f3cd swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) + 1133
24 sil-opt         0x00000000007758a9 swift::CompilerInstance::performSema() + 3289
25 sil-opt         0x000000000075ec65 main + 1813
Stack dump:
0.	Program arguments: sil-opt -enable-sil-verify-all
1.	While type-checking expression at [<stdin>:3:1 - line:3:6] RangeText=".x.a=I"
2.	While type-checking expression at [<stdin>:3:1 - line:3:6] RangeText=".x.a=I"
```
2016-09-11 11:22:27 +02:00
practicalswift
8fea568512 [SIL] Add test case for crash triggered in swift::constraints::ConstraintSystem::diagnoseFailureForExpr(swift::Expr*)
Stack trace:

```
<stdin>:3:4: error: expected expression in list of expressions
if(import Swift
   ^
<stdin>:3:4: error: expected ',' separator
if(import Swift
   ^
   ,
<stdin>:3:4: error: expected ')' in expression list
if(import Swift
   ^
<stdin>:3:3: note: to match this opening '('
if(import Swift
  ^
<stdin>:3:4: error: expected '{' after 'if' condition
if(import Swift
   ^
sil-opt: /path/to/swift/lib/Sema/TypeCheckNameLookup.cpp:254: swift::LookupResult swift::TypeChecker::lookupMember(swift::DeclContext *, swift::Type, swift::DeclName, NameLookupOptions): Assertion `!type->is<TupleType>()' failed.
9  sil-opt         0x0000000000bb2386 swift::constraints::ConstraintSystem::diagnoseFailureForExpr(swift::Expr*) + 5990
10 sil-opt         0x0000000000bb750e swift::constraints::ConstraintSystem::salvage(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::Expr*) + 4078
11 sil-opt         0x0000000000adf6f7 swift::TypeChecker::solveForExpression(swift::Expr*&, swift::DeclContext*, swift::Type, swift::FreeTypeVariableBinding, swift::ExprTypeCheckListener*, swift::constraints::ConstraintSystem&, llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>) + 471
12 sil-opt         0x0000000000ae2dd5 swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*, swift::constraints::ConstraintSystem*) + 949
13 sil-opt         0x0000000000ae7c74 swift::TypeChecker::typeCheckCondition(swift::Expr*&, swift::DeclContext*) + 180
14 sil-opt         0x0000000000ae7dcb swift::TypeChecker::typeCheckStmtCondition(llvm::MutableArrayRef<swift::StmtConditionElement>&, swift::DeclContext*, swift::Diag<>) + 251
17 sil-opt         0x0000000000b66cd6 swift::TypeChecker::typeCheckTopLevelCodeDecl(swift::TopLevelCodeDecl*) + 134
18 sil-opt         0x0000000000b1f3cd swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) + 1133
19 sil-opt         0x00000000007758a9 swift::CompilerInstance::performSema() + 3289
20 sil-opt         0x000000000075ec65 main + 1813
Stack dump:
0.	Program arguments: sil-opt -enable-sil-verify-all
1.	While type-checking expression at [<stdin>:3:3 - line:3:3] RangeText="("
```
2016-09-10 13:52:04 +02:00
Slava Pestov
e72808c1ce Fixed SIL crashers 2016-08-28 13:51:39 -07:00
Dmitri Gribenko
d175b3b66d Migrate FileCheck to %FileCheck in tests 2016-08-10 23:52:02 -07:00
Slava Pestov
0004bc480a IRGen: Differentiate between Swift.Bool and ObjCBool
SIL already does this where necessary, except with foreign throwing
functions; this patch changes Sema and the ClangImporter to give
them an ObjCBool foreign error result type explicitly.

This fixes a problem where calls to functions taking and returning
the C99 _Bool type were miscompiled on Mac OS X x86-64, because
IRGen was conflating the Objective-C BOOL type (which is a signed
char on some platforms) and C99 _Bool (which lowers as the LLVM
i1 type).

Fixes <rdar://problem/26506458> and <rdar://problem/27365520>.
2016-08-10 10:34:24 -07:00
practicalswift
5b88f42826 [SIL] Add test case for crash triggered in swift::IterativeTypeChecker::satisfy(swift::TypeCheckRequest)
Stack trace:

```
<stdin>:3:12: error: expected '=' in typealias declaration
typealias E:<__>__
           ^
           =
<stdin>:3:13: error: only syntactic function types can be generic
typealias E:<__>__
            ^
sil-opt: /path/to/swift/lib/Sema/IterativeTypeChecker.cpp:103: void swift::IterativeTypeChecker::satisfy(swift::TypeCheckRequest): Assertion `isSatisfied(request)' failed.
9  sil-opt         0x0000000000bff669 swift::IterativeTypeChecker::satisfy(swift::TypeCheckRequest) + 889
12 sil-opt         0x0000000000aeac64 swift::TypeChecker::validateDecl(swift::ValueDecl*, bool) + 3396
15 sil-opt         0x0000000000aef886 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 150
16 sil-opt         0x0000000000b13f92 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) + 1026
17 sil-opt         0x00000000007726e9 swift::CompilerInstance::performSema() + 3289
18 sil-opt         0x000000000075bb9d main + 1805
Stack dump:
0.	Program arguments: sil-opt -enable-sil-verify-all
1.	While type-checking 'E' at <stdin>:3:1
2.	While type-checking 'E' at <stdin>:3:1
```
2016-07-23 18:20:57 +02:00
practicalswift
ed360c904e [SIL] Add test case for crash triggered in swift::TypeChecker::configureInterfaceType(swift::AbstractFunctionDecl*)
Stack trace:

```
<stdin>:3:7: error: expected '(' in argument list of function declaration
func y:@opened(Any
      ^
<stdin>:3:7: error: expected '->' after function parameter tuple
func y:@opened(Any
      ^
      ->
<stdin>:3:16: error: known id for 'opened' attribute must be a UUID string
func y:@opened(Any
               ^
<stdin>:3:16: error: expected ')' after id value for 'opened' attribute
func y:@opened(Any
               ^
<stdin>:3:15: note: to match this opening '('
func y:@opened(Any
              ^
sil-opt: /path/to/swift/lib/Sema/TypeCheckGeneric.cpp:650: void swift::TypeChecker::configureInterfaceType(swift::AbstractFunctionDecl *): Assertion `!funcTy->hasArchetype()' failed.
8  sil-opt         0x0000000000b2aedf swift::TypeChecker::configureInterfaceType(swift::AbstractFunctionDecl*) + 2047
11 sil-opt         0x0000000000aef886 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 150
12 sil-opt         0x0000000000b13f92 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) + 1026
13 sil-opt         0x00000000007726e9 swift::CompilerInstance::performSema() + 3289
14 sil-opt         0x000000000075bb9d main + 1805
Stack dump:
0.	Program arguments: sil-opt -enable-sil-verify-all
1.	While type-checking 'y' at <stdin>:3:1
```
2016-07-23 16:42:20 +02:00
practicalswift
f047c00bb1 [SIL] Add test case for crash triggered in swift::TypeChecker::checkDeclAttributes(swift::Decl*)
Stack trace:

```
<stdin>:3:22: error: expected '(' in argument list of function declaration
@_specialize(h)func f
                     ^
5  sil-opt         0x0000000000c16941 swift::TypeChecker::checkDeclAttributes(swift::Decl*) + 49
8  sil-opt         0x0000000000aef886 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 150
9  sil-opt         0x0000000000b13f92 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) + 1026
10 sil-opt         0x00000000007726e9 swift::CompilerInstance::performSema() + 3289
11 sil-opt         0x000000000075bb9d main + 1805
Stack dump:
0.	Program arguments: sil-opt -enable-sil-verify-all
1.	While type-checking 'f' at <stdin>:3:16
```
2016-07-23 13:31:09 +02:00
practicalswift
1e1385c51b [SIL] Add test case for crash triggered in swift::Parser::parseSILScope()
Stack trace:

```
sil-opt: /path/to/swift/include/swift/Parse/Parser.h:412: swift::SourceLoc swift::Parser::consumeToken(swift::tok): Assertion `Tok.is(K) && "Consuming wrong token kind"' failed.
8  sil-opt         0x0000000000a62cae swift::Parser::parseSILScope() + 2478
9  sil-opt         0x0000000000a9835b swift::Parser::parseTopLevel() + 827
10 sil-opt         0x0000000000a51170 swift::parseIntoSourceFile(swift::SourceFile&, unsigned int, bool*, swift::SILParserState*, swift::PersistentParserState*, swift::DelayedParsingCallbacks*) + 208
11 sil-opt         0x00000000007726c6 swift::CompilerInstance::performSema() + 3254
12 sil-opt         0x000000000075bb9d main + 1805
Stack dump:
0.	Program arguments: sil-opt -enable-sil-verify-all
1.	With parser at source location: <stdin>:3:12
```
2016-07-23 11:14:03 +02:00
practicalswift
1665369fa9 Merge pull request #3562 from practicalswift/sil-027-swift-nominaltypedecl-getdeclaredtype
[SIL] Add test case for crash triggered in swift::NominalTypeDecl::getDeclaredType()
2016-07-23 11:10:49 +02:00
practicalswift
4d201520ef Add REQUIRES line to reflect that the crash case seems to trigger under Linux only. 2016-07-23 05:51:02 +02:00
practicalswift
ac4d255f79 [SIL] Add test case for crash triggered in swift::NominalTypeDecl::getDeclaredType() const
Stack trace:

```
<stdin>:3:5: error: expected expression in list of expressions
bb0(@test_existential_metatype : $Int
    ^
<stdin>:3:5: error: expected ',' separator
bb0(@test_existential_metatype : $Int
    ^
    ,
<stdin>:3:5: error: expected ')' in expression list
bb0(@test_existential_metatype : $Int
    ^
<stdin>:3:4: note: to match this opening '('
bb0(@test_existential_metatype : $Int
   ^
<stdin>:3:1: error: expressions are not allowed at the top level
bb0(@test_existential_metatype : $Int
^
<stdin>:3:5: error: consecutive statements on a line must be separated by ';'
bb0(@test_existential_metatype : $Int
    ^
    ;
<stdin>:3:6: error: unknown attribute 'test_existential_metatype'
bb0(@test_existential_metatype : $Int
     ^
<stdin>:3:34: error: expected numeric value following '$'
bb0(@test_existential_metatype : $Int
                                 ^
<stdin>:3:32: error: expected declaration
bb0(@test_existential_metatype : $Int
                               ^
<stdin>:4:9: error: attribute can only be applied to types, not declarations
%0 to $@callee_owned (thin) -> ("01234567-cdef-> (thin) -> @owned @callee_owned (Int
        ^
<stdin>:4:22: error: expected declaration
%0 to $@callee_owned (thin) -> ("01234567-cdef-> (thin) -> @owned @callee_owned (Int
                     ^
<stdin>:4:33: error: unterminated string literal
%0 to $@callee_owned (thin) -> ("01234567-cdef-> (thin) -> @owned @callee_owned (Int
                                ^
<stdin>:7:1: error: expressions are not allowed at the top level
%0 : $@convention(thin) -> ()
^
<stdin>:7:3: error: consecutive statements on a line must be separated by ';'
%0 : $@convention(thin) -> ()
  ^
  ;
<stdin>:7:4: error: expected expression
%0 : $@convention(thin) -> ()
   ^
<stdin>:7:8: error: attribute can only be applied to types, not declarations
%0 : $@convention(thin) -> ()
       ^
<stdin>:7:18: error: expected declaration
%0 : $@convention(thin) -> ()
                 ^
<stdin>:8:20: error: expected numeric value following '$'
strong_retain %0 : $Beth
                   ^
<stdin>:10:8: error: attribute can only be applied to types, not declarations
%0 : $@box Int) : $@_TF6switch1aFT_T_ : $*Spoon
       ^
<stdin>:10:12: error: expected declaration
%0 : $@box Int) : $@_TF6switch1aFT_T_ : $*Spoon
           ^
<stdin>:10:21: error: unknown attribute '_TF6switch1aFT_T_'
%0 : $@box Int) : $@_TF6switch1aFT_T_ : $*Spoon
                    ^
<stdin>:10:39: error: expected declaration
%0 : $@box Int) : $@_TF6switch1aFT_T_ : $*Spoon
                                      ^
<stdin>:11:10: error: expected numeric value following '$'
bb0(%2 : $Builtin.FPIEEE64, 1) ()
         ^
<stdin>:12:16: error: attribute can only be applied to types, not declarations
sil [fragile] @guaranteed A)) {
               ^
<stdin>:12:27: error: expected declaration
sil [fragile] @guaranteed A)) {
                          ^
<stdin>:12:31: error: statement cannot begin with a closure expression
sil [fragile] @guaranteed A)) {
                              ^
<stdin>:12:31: note: explicitly discard the result of the closure by assigning to '_'
sil [fragile] @guaranteed A)) {
                              ^
                              _ =
<stdin>:12:31: error: expressions are not allowed at the top level
sil [fragile] @guaranteed A)) {
                              ^
<stdin>:12:31: error: braced block of statements is an unused closure
sil [fragile] @guaranteed A)) {
                              ^
<stdin>:14:5: error: initializers may only be declared within a type
init()
    ^
<stdin>:15:6: error: expected numeric value following '$'
%3 : $Builtin.Int32
     ^
<stdin>:15:1: error: expressions are not allowed at the top level
%3 : $Builtin.Int32
^
<stdin>:15:3: error: consecutive statements on a line must be separated by ';'
%3 : $Builtin.Int32
  ^
  ;
<stdin>:15:4: error: expected expression
%3 : $Builtin.Int32
   ^
<stdin>:16:20: error: expected a digit after integer literal prefix
inject_enum_addr %0a : $*Spoon
                   ^
<stdin>:18:2: error: attribute can only be applied to types, not declarations
@convention(thin) -> (Int, bb1, #Optional<Int) -> (thin) ()
 ^
<stdin>:18:12: error: expected declaration
@convention(thin) -> (Int, bb1, #Optional<Int) -> (thin) ()
           ^
<stdin>:19:6: error: expected numeric value following '$'
%0 : $Builtin.some!enumelt.Word) (thin) -> ()) (thin) ("01234567-> () (thin) -> Int) ()
     ^
<stdin>:19:56: error: unterminated string literal
%0 : $Builtin.some!enumelt.Word) (thin) -> ()) (thin) ("01234567-> () (thin) -> Int) ()
                                                       ^
<stdin>:20:16: error: expected numeric value following '$'
%6 = alloc_box $C
               ^
<stdin>:21:20: error: unknown attribute 'test_unreachable'
%5 = function_ref @test_unreachable : $C, @owned @box M
                   ^
<stdin>:21:39: error: expected numeric value following '$'
%5 = function_ref @test_unreachable : $C, @owned @box M
                                      ^
<stdin>:21:37: error: expected declaration
%5 = function_ref @test_unreachable : $C, @owned @box M
                                    ^
<stdin>:21:44: error: attribute can only be applied to types, not declarations
%5 = function_ref @test_unreachable : $C, @owned @box M
                                           ^
<stdin>:21:50: error: expected declaration
%5 = function_ref @test_unreachable : $C, @owned @box M
                                                 ^
<stdin>:21:51: error: attribute can only be applied to types, not declarations
%5 = function_ref @test_unreachable : $C, @owned @box M
                                                  ^
<stdin>:21:55: error: expected declaration
%5 = function_ref @test_unreachable : $C, @owned @box M
                                                      ^
<stdin>:24:27: error: unknown attribute 'test_checked_cast_br_jump_threading_with_entry_bb_arguments'
%1 = load_weak [fragile] @test_checked_cast_br_jump_threading_with_entry_bb_arguments : $@globalinit_func0 : $SomeSubclass
                          ^
<stdin>:24:87: error: expected declaration
%1 = load_weak [fragile] @test_checked_cast_br_jump_threading_with_entry_bb_arguments : $@globalinit_func0 : $SomeSubclass
                                                                                      ^
<stdin>:24:91: error: unknown attribute 'globalinit_func0'
%1 = load_weak [fragile] @test_checked_cast_br_jump_threading_with_entry_bb_arguments : $@globalinit_func0 : $SomeSubclass
                                                                                          ^
<stdin>:24:110: error: expected numeric value following '$'
%1 = load_weak [fragile] @test_checked_cast_br_jump_threading_with_entry_bb_arguments : $@globalinit_func0 : $SomeSubclass
                                                                                                             ^
<stdin>:24:108: error: expected declaration
%1 = load_weak [fragile] @test_checked_cast_br_jump_threading_with_entry_bb_arguments : $@globalinit_func0 : $SomeSubclass
                                                                                                           ^
<stdin>:25:1: error: statements are not allowed at the top level
return %2 = project_box %10 = functionref @callee_owned ()) : $@callee_owned ()
^
<stdin>:25:24: error: consecutive statements on a line must be separated by ';'
return %2 = project_box %10 = functionref @callee_owned ()) : $@callee_owned ()
                       ^
                       ;
<stdin>:25:25: error: expressions are not allowed at the top level
return %2 = project_box %10 = functionref @callee_owned ()) : $@callee_owned ()
                        ^
<stdin>:25:42: error: consecutive statements on a line must be separated by ';'
return %2 = project_box %10 = functionref @callee_owned ()) : $@callee_owned ()
                                         ^
                                         ;
<stdin>:25:44: error: attribute can only be applied to types, not declarations
return %2 = project_box %10 = functionref @callee_owned ()) : $@callee_owned ()
                                           ^
<stdin>:25:57: error: expected declaration
return %2 = project_box %10 = functionref @callee_owned ()) : $@callee_owned ()
                                                        ^
<stdin>:25:65: error: attribute can only be applied to types, not declarations
return %2 = project_box %10 = functionref @callee_owned ()) : $@callee_owned ()
                                                                ^
<stdin>:25:78: error: expected declaration
return %2 = project_box %10 = functionref @callee_owned ()) : $@callee_owned ()
                                                                             ^
<stdin>:26:1: error: extraneous '}' at top level
}
^
<stdin>:27:19: error: expected expression in list of expressions
%115 = tuple (%1, @_TFSb21_getBuiltinLogicValuefSbFT_Bi1_ : $ImplicitlyUnwrappedOptional<Int8>
                  ^
<stdin>:27:19: error: expected ',' separator
%115 = tuple (%1, @_TFSb21_getBuiltinLogicValuefSbFT_Bi1_ : $ImplicitlyUnwrappedOptional<Int8>
                  ^
                 ,
<stdin>:27:19: error: expected ')' in expression list
%115 = tuple (%1, @_TFSb21_getBuiltinLogicValuefSbFT_Bi1_ : $ImplicitlyUnwrappedOptional<Int8>
                  ^
<stdin>:27:14: note: to match this opening '('
%115 = tuple (%1, @_TFSb21_getBuiltinLogicValuefSbFT_Bi1_ : $ImplicitlyUnwrappedOptional<Int8>
             ^
<stdin>:27:1: error: expressions are not allowed at the top level
%115 = tuple (%1, @_TFSb21_getBuiltinLogicValuefSbFT_Bi1_ : $ImplicitlyUnwrappedOptional<Int8>
^
<stdin>:27:18: error: consecutive statements on a line must be separated by ';'
%115 = tuple (%1, @_TFSb21_getBuiltinLogicValuefSbFT_Bi1_ : $ImplicitlyUnwrappedOptional<Int8>
                 ^
                 ;
<stdin>:27:20: error: unknown attribute '_TFSb21_getBuiltinLogicValuefSbFT_Bi1_'
%115 = tuple (%1, @_TFSb21_getBuiltinLogicValuefSbFT_Bi1_ : $ImplicitlyUnwrappedOptional<Int8>
                   ^
<stdin>:27:61: error: expected numeric value following '$'
%115 = tuple (%1, @_TFSb21_getBuiltinLogicValuefSbFT_Bi1_ : $ImplicitlyUnwrappedOptional<Int8>
                                                            ^
<stdin>:27:59: error: expected declaration
%115 = tuple (%1, @_TFSb21_getBuiltinLogicValuefSbFT_Bi1_ : $ImplicitlyUnwrappedOptional<Int8>
                                                          ^
<stdin>:28:8: error: unknown attribute '_TF6switch1cFT_T_'
%v : $@_TF6switch1cFT_T_ : $Int32) (thin) (thin) () : $@callee_owned ()) -0123-> ()
       ^
<stdin>:28:28: error: expected numeric value following '$'
%v : $@_TF6switch1cFT_T_ : $Int32) (thin) (thin) () : $@callee_owned ()) -0123-> ()
                           ^
<stdin>:28:26: error: expected declaration
%v : $@_TF6switch1cFT_T_ : $Int32) (thin) (thin) () : $@callee_owned ()) -0123-> ()
                         ^
<stdin>:28:57: error: attribute can only be applied to types, not declarations
%v : $@_TF6switch1cFT_T_ : $Int32) (thin) (thin) () : $@callee_owned ()) -0123-> ()
                                                        ^
<stdin>:28:70: error: expected declaration
%v : $@_TF6switch1cFT_T_ : $Int32) (thin) (thin) () : $@callee_owned ()) -0123-> ()
                                                                     ^
<stdin>:29:34: error: attribute can only be applied to types, not declarations
store %33 = alloc_ref [fragile] @convention(%5 : $@out Bendable, %99 = tuple (thin) -> ():
                                 ^
<stdin>:29:44: error: expected declaration
store %33 = alloc_ref [fragile] @convention(%5 : $@out Bendable, %99 = tuple (thin) -> ():
                                           ^
<stdin>:31:36: error: expected numeric value following '$'
%5 = function_ref @convention(%6 : $Builtin.Int1
                                   ^
<stdin>:36:34: error: unterminated string literal
store %1 = tuple () -000000000000") {
                                 ^
<stdin>:38:32: error: attribute can only be applied to types, not declarations
%8 : $*Builtin.some!enumelt: $@box Spoon
                               ^
<stdin>:38:36: error: expected declaration
%8 : $*Builtin.some!enumelt: $@box Spoon
                                   ^
<stdin>:40:1: error: extraneous '}' at top level
}
^
<stdin>:41:1: error: extraneous '}' at top level
}
^
<stdin>:42:1: error: expressions are not allowed at the top level
bb0(thin) : AssocReqt module def_basic {}
^
<stdin>:42:10: error: consecutive statements on a line must be separated by ';'
bb0(thin) : AssocReqt module def_basic {}
         ^
         ;
<stdin>:42:11: error: expected expression
bb0(thin) : AssocReqt module def_basic {}
          ^
<stdin>:42:40: error: statement cannot begin with a closure expression
bb0(thin) : AssocReqt module def_basic {}
                                       ^
<stdin>:42:40: note: explicitly discard the result of the closure by assigning to '_'
bb0(thin) : AssocReqt module def_basic {}
                                       ^
                                       _ =
<stdin>:42:40: error: expressions are not allowed at the top level
bb0(thin) : AssocReqt module def_basic {}
                                       ^
<stdin>:42:40: error: braced block of statements is an unused closure
bb0(thin) : AssocReqt module def_basic {}
                                       ^
<stdin>:43:1: error: expressions are not allowed at the top level
%12 = strong_release %5 : $*Spoon
^
<stdin>:43:21: error: consecutive statements on a line must be separated by ';'
%12 = strong_release %5 : $*Spoon
                    ^
                    ;
<stdin>:43:22: error: expressions are not allowed at the top level
%12 = strong_release %5 : $*Spoon
                     ^
<stdin>:43:24: error: consecutive statements on a line must be separated by ';'
%12 = strong_release %5 : $*Spoon
                       ^
                       ;
<stdin>:43:25: error: expected expression
%12 = strong_release %5 : $*Spoon
                        ^
<stdin>:45:17: error: unterminated string literal
sil [_semantics "foo(%2 = apply [fragile] @owned A>
                ^
<stdin>:46:19: error: attribute can only be applied to types, not declarations
%14 = alloc_box $@convention(thin) : $@owned A, bb1:
                  ^
<stdin>:46:29: error: expected declaration
%14 = alloc_box $@convention(thin) : $@owned A, bb1:
                            ^
<stdin>:46:40: error: attribute can only be applied to types, not declarations
%14 = alloc_box $@convention(thin) : $@owned A, bb1:
                                       ^
<stdin>:46:46: error: expected declaration
%14 = alloc_box $@convention(thin) : $@owned A, bb1:
                                             ^
<stdin>:47:1: error: extraneous '}' at top level
}
^
<stdin>:48:1: error: extraneous '}' at top level
}
^
<stdin>:49:8: error: expected '{' in class
class B
       ^
<stdin>:50:1: error: extraneous '}' at top level
}
^
<stdin>:51:10: error: expected type
var free:
         ^
<stdin>:52:6: error: expected numeric value following '$'
%0 : $SomeProtocol.RawPointer
     ^
<stdin>:52:1: error: expressions are not allowed at the top level
%0 : $SomeProtocol.RawPointer
^
<stdin>:52:3: error: consecutive statements on a line must be separated by ';'
%0 : $SomeProtocol.RawPointer
  ^
  ;
<stdin>:52:4: error: expected expression
%0 : $SomeProtocol.RawPointer
   ^
<stdin>:53:5: error: initializers may only be declared within a type
init(@owned Optional<C>
    ^
<stdin>:53:6: error: expected parameter name followed by ':'
init(@owned Optional<C>
     ^
<stdin>:53:6: error: expected ',' separator
init(@owned Optional<C>
     ^
     ,
<stdin>:53:6: error: expected ')' in parameter
init(@owned Optional<C>
     ^
<stdin>:53:5: note: to match this opening '('
init(@owned Optional<C>
    ^
<stdin>:53:6: error: consecutive statements on a line must be separated by ';'
init(@owned Optional<C>
     ^
     ;
<stdin>:53:7: error: attribute can only be applied to types, not declarations
init(@owned Optional<C>
      ^
<stdin>:53:13: error: expected declaration
init(@owned Optional<C>
            ^
<stdin>:54:1: error: extraneous '}' at top level
}
^
4  sil-opt         0x0000000000e07de4 swift::NominalTypeDecl::getDeclaredType() const + 4
15 sil-opt         0x0000000000ccf99d swift::ClangModuleUnit::lookupVisibleDecls(llvm::ArrayRef<std::pair<swift::Identifier, swift::SourceLoc> >, swift::VisibleDeclConsumer&, swift::NLKind) const + 317
16 sil-opt         0x0000000000e35bb6 swift::ModuleDecl::lookupVisibleDecls(llvm::ArrayRef<std::pair<swift::Identifier, swift::SourceLoc> >, swift::VisibleDeclConsumer&, swift::NLKind) const + 70
19 sil-opt         0x0000000000e4081d swift::namelookup::lookupVisibleDeclsInModule(swift::ModuleDecl*, llvm::ArrayRef<std::pair<swift::Identifier, swift::SourceLoc> >, llvm::SmallVectorImpl<swift::ValueDecl*>&, swift::NLKind, swift::namelookup::ResolutionKind, swift::LazyResolver*, swift::DeclContext const*, llvm::ArrayRef<std::pair<llvm::ArrayRef<std::pair<swift::Identifier, swift::SourceLoc> >, swift::ModuleDecl*> >) + 1101
20 sil-opt         0x0000000000e26ce2 swift::lookupVisibleDecls(swift::VisibleDeclConsumer&, swift::DeclContext const*, swift::LazyResolver*, bool, swift::SourceLoc) + 1746
21 sil-opt         0x0000000000b29962 swift::TypeChecker::performTypoCorrection(swift::DeclContext*, swift::DeclRefKind, swift::Type, swift::DeclName, swift::SourceLoc, swift::OptionSet<swift::NameLookupFlags, unsigned int>, swift::LookupResult&, unsigned int) + 290
22 sil-opt         0x0000000000ad1d09 swift::TypeChecker::resolveDeclRefExpr(swift::UnresolvedDeclRefExpr*, swift::DeclContext*) + 3929
26 sil-opt         0x0000000000da552e swift::Expr::walk(swift::ASTWalker&) + 46
27 sil-opt         0x0000000000ad2590 swift::TypeChecker::solveForExpression(swift::Expr*&, swift::DeclContext*, swift::Type, swift::FreeTypeVariableBinding, swift::ExprTypeCheckListener*, swift::constraints::ConstraintSystem&, llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>) + 224
28 sil-opt         0x0000000000ad8fc2 swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*) + 610
30 sil-opt         0x0000000000b542e6 swift::TypeChecker::typeCheckTopLevelCodeDecl(swift::TopLevelCodeDecl*) + 134
31 sil-opt         0x0000000000b0e0ed swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) + 1133
32 sil-opt         0x0000000000772169 swift::CompilerInstance::performSema() + 3289
33 sil-opt         0x000000000075b63d main + 1805
Stack dump:
0.	Program arguments: sil-opt -enable-sil-verify-all
1.	While type-checking expression at [<stdin>:3:1 - line:3:4] RangeText="bb0("
2.	/usr/local/bin/swift/lib/swift/shims/HeapObject.h:38:8: importing 'HeapObject'
3.	/usr/local/bin/swift/lib/swift/shims/HeapObject.h:40:23: importing 'HeapObject::metadata'
```
2016-07-23 05:46:41 +02:00
practicalswift
2297b637ad [SIL] Add test case for crash triggered in swift::GenericSignature::getCanonicalSignature() const
Stack trace:

```
<stdin>:3:25: error: expected type
sil_global@d:$(<τ>()->(
<stdin>:3:25: error: expected ',' separator
sil_global@d:$(<τ>()->(
<stdin>:3:25: error: expected ',' separator
sil_global@d:$(<τ>()->(
<stdin>:3:25: error: expected type
sil_global@d:$(<τ>()->(
<stdin>:3:25: error: expected ',' separator
sil_global@d:$(<τ>()->(
4  sil-opt         0x0000000000e2b537 swift::GenericSignature::getCanonicalSignature() const + 7
7  sil-opt         0x0000000000b617b4 swift::TypeChecker::resolveType(swift::TypeRepr*, swift::DeclContext*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 164
8  sil-opt         0x0000000000b60750 swift::TypeChecker::validateType(swift::TypeLoc&, swift::DeclContext*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 192
9  sil-opt         0x0000000000b14911 swift::performTypeLocChecking(swift::ASTContext&, swift::TypeLoc&, bool, swift::DeclContext*, bool) + 561
11 sil-opt         0x0000000000a5c2b4 swift::Parser::parseSILGlobal() + 548
12 sil-opt         0x0000000000a982fb swift::Parser::parseTopLevel() + 731
13 sil-opt         0x0000000000a51170 swift::parseIntoSourceFile(swift::SourceFile&, unsigned int, bool*, swift::SILParserState*, swift::PersistentParserState*, swift::DelayedParsingCallbacks*) + 208
14 sil-opt         0x00000000007726c6 swift::CompilerInstance::performSema() + 3254
15 sil-opt         0x000000000075bb9d main + 1805
Stack dump:
0.	Program arguments: sil-opt -enable-sil-verify-all
1.	With parser at source location: <stdin>:3:25
2.	While resolving type (() -> ()) at [<stdin>:3:15 - line:3:24] RangeText="(<τ>()->("
```
2016-07-23 05:43:03 +02:00
practicalswift
6fcbf7492b [SIL] Add test case for crash triggered in swift::Parser::parseSILDefaultWitnessTable()
Stack trace:

```
<stdin>:3:26: error: expected SIL value name
sil_default_witness_table
                         ^
sil-opt: /path/to/swift/include/swift/Parse/Parser.h:412: swift::SourceLoc swift::Parser::consumeToken(swift::tok): Assertion `Tok.is(K) && "Consuming wrong token kind"' failed.
8  sil-opt         0x0000000000a5d1d8 swift::Parser::parseSILDefaultWitnessTable() + 2248
9  sil-opt         0x0000000000a9452b swift::Parser::parseTopLevel() + 779
10 sil-opt         0x0000000000a4e0c0 swift::parseIntoSourceFile(swift::SourceFile&, unsigned int, bool*, swift::SILParserState*, swift::PersistentParserState*, swift::DelayedParsingCallbacks*) + 208
11 sil-opt         0x0000000000772146 swift::CompilerInstance::performSema() + 3254
12 sil-opt         0x000000000075b63d main + 1805
Stack dump:
0.	Program arguments: sil-opt -enable-sil-verify-all
1.	With parser at source location: <stdin>:3:26
```
2016-07-17 12:04:17 +02:00