Commit Graph

172 Commits

Author SHA1 Message Date
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
practicalswift
976fc052f8 [SIL] Add test case for crash triggered in swift::TypeChecker::resolveType(swift::TypeRepr*, swift::DeclContext*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*)
Stack trace:

```
<stdin>:3:18: error: expected '(' in argument list of function declaration
protocol l{func t-> <T>()->(
                 ^
<stdin>:3:29: error: expected type
protocol l{func t-> <T>()->(
                            ^
<stdin>:3:29: error: expected ',' separator
protocol l{func t-> <T>()->(
                            ^
                            ,
<stdin>:3:29: error: consecutive declarations on a line must be separated by ';'
protocol l{func t-> <T>()->(
                            ^
                            ;
<stdin>:3:29: error: expected declaration
protocol l{func t-> <T>()->(
                            ^
<stdin>:3:10: note: in declaration of 'l'
protocol l{func t-> <T>()->(
         ^
sil-opt: /path/to/swift/lib/Sema/TypeCheckType.cpp:1964: swift::Type (anonymous namespace)::TypeResolver::resolveASTFunctionType(swift::FunctionTypeRepr *, TypeResolutionOptions, FunctionType::ExtInfo): Assertion `genericSig != nullptr && "Did not call handleSILGenericParams()?"' failed.
9  sil-opt         0x0000000000b5a904 swift::TypeChecker::resolveType(swift::TypeRepr*, swift::DeclContext*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 164
10 sil-opt         0x0000000000b598a0 swift::TypeChecker::validateType(swift::TypeLoc&, swift::DeclContext*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 192
12 sil-opt         0x0000000000b2398e swift::TypeChecker::validateGenericFuncSignature(swift::AbstractFunctionDecl*) + 94
17 sil-opt         0x0000000000aea496 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 150
18 sil-opt         0x0000000000b0d762 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) + 1026
19 sil-opt         0x0000000000772259 swift::CompilerInstance::performSema() + 3289
20 sil-opt         0x000000000075b72d main + 1805
Stack dump:
0.	Program arguments: sil-opt -enable-sil-verify-all
1.	While type-checking 'l' at <stdin>:3:1
2.	While resolving type () -> () at [<stdin>:3:24 - line:3:28] RangeText="()->("
```
2016-07-16 21:09:42 +02:00
Doug Gregor
823c24b355 [SE-0112] Rename ErrorProtocol to Error.
This is bullet (5) of the proposed solution in SE-0112, and the last
major piece to be implemented.
2016-07-12 10:53:52 -07:00
Slava Pestov
69d8867ec5 A SIL parser crasher got fixed along the way 2016-06-18 17:15:25 -07:00
Brian Gesiak
fd3ecb1d94 [test] Prepare tests to run on Android
- Expand operating system checks such that Glibc is properly
  imported on Android.
- For tests that are unsupported on platforms that normally
  do not support an Objective-C runtime, expand the unsupported
  checks to include Android.
- Pass the `-sdk` parameter when invoking `%target-sil-opt`.
- Expect failures when testing semaphores, which are not included
  in Android Bionic.
2016-06-07 15:59:51 -04:00
Dmitri Gribenko
a30f90c965 CMake: move tricky code from CMake to Python
Removing an abstraction boundary also allowed me to fix a bug where we
could not run long tests in optimized mode, which prevented us from
being able to mark executable tests as long.
2016-06-06 01:02:03 -07:00
Dmitri Gribenko
457f2b901c CMake & build-script: add a new tier of testing, "long tests"
* The behavior of `build-script -t` is unchanged.

* `build-script -T` continues to run primary and validation test suite,
  but without the long tests.

* `build-script --long-test` runs just the long tests.

* `build-script -T --long-test` runs all tests.
2016-04-16 14:03:54 -07:00
Manav Gabhawala
7928140f79 [SE-0046] Implements consistent function parameter labels by discarding extraneous parameter names and adding _ where necessary 2016-04-06 20:21:58 -04:00
John McCall
38498bd7fd This test is no longer crashing. 2016-02-18 01:45:50 -08:00
Chris Lattner
1e380ac991 my fix fixed this testcase too. 2016-02-01 22:31:21 -08:00
Chris Lattner
58e33ee374 My previous patch fixed this too accidentally, update the test. 2016-01-29 14:57:57 -08:00
Dmitri Gribenko
220bac09a7 Remove 'asserts' requirements from fixed compiler crash tests 2016-01-20 14:40:36 -08:00
Doug Gregor
38c1de69e4 Reinstate "[SR-511][Parse] Add 'associatedtype' keyword and fixit"
This reverts commit ce7b2bcf09, tweaking
a few validation tests appropriately (1 crasher fixed, two -verify
tests that needed updating).
2016-01-14 00:21:48 -08:00
Chris Lattner
2f4bec9e8c subsume the "startsWithGreater" logic into skipUntilGreaterInTypeList, and make sure skipUntilGreaterInTypeList return a valid location even in the case of parse errors. This ensures that we form a valid source range. Also, improve parseExprIdentifier() to handle the case when skipUntilGreaterInTypeList returns an empty archetype argument list. This fixes a couple of compiler crashers. 2016-01-09 20:36:05 -08:00
Chris Lattner
f796899123 subsume the "startsWithGreater" logic into skipUntilGreaterInTypeList, and
make sure skipUntilGreaterInTypeList return a valid location even in the case
of parse errors.  This ensures that we form a valid source range.  Also,
improve parseExprIdentifier() to handle the case when skipUntilGreaterInTypeList
returns an empty archetype argument list.  This fixes a couple of compiler
crashers.
2016-01-09 20:36:05 -08:00
practicalswift
c7187cb901 [SIL] Add test case for crash triggered in llvm::llvm_unreachable_internal(char const*, char const*, unsigned int)
Stack trace:

```
<stdin>:3:1: error: statement cannot begin with a closure expression
{(x:(x:(
^
<stdin>:3:1: note: explicitly discard the result of the closure by assigning to '_'
{(x:(x:(
^
_ =
<stdin>:3:9: error: expected expression in list of expressions
{(x:(x:(
        ^
<stdin>:3:9: error: expected ',' separator
{(x:(x:(
        ^
        ,
<stdin>:3:9: error: expected ',' separator
{(x:(x:(
        ^
        ,
<stdin>:3:9: error: expected expression in list of expressions
{(x:(x:(
        ^
<stdin>:3:9: error: expected ',' separator
{(x:(x:(
        ^
        ,
<stdin>:3:9: error: expected ',' separator
{(x:(x:(
        ^
        ,
<stdin>:3:9: error: expected expression in list of expressions
{(x:(x:(
        ^
<stdin>:3:9: error: expected ',' separator
{(x:(x:(
        ^
        ,
<stdin>:3:9: error: expected '}' at end of closure
{(x:(x:(
        ^
<stdin>:3:1: note: to match this opening '{'
{(x:(x:(
^
<stdin>:3:1: error: expressions are not allowed at the top level
{(x:(x:(
^
<stdin>:3:1: error: braced block of statements is an unused closure
{(x:(x:(
^
Unhandled coercion
UNREACHABLE executed at /path/to/swift/lib/Sema/CSApply.cpp:4913!
6  sil-opt         0x0000000002c115cd llvm::llvm_unreachable_internal(char const*, char const*, unsigned int) + 461
11 sil-opt         0x0000000000ccfdd3 swift::Expr::walk(swift::ASTWalker&) + 19
12 sil-opt         0x0000000000b15286 swift::constraints::ConstraintSystem::applySolution(swift::constraints::Solution&, swift::Expr*, swift::Type, bool, bool, bool) + 502
13 sil-opt         0x0000000000a8730b swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::Type, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*) + 683
15 sil-opt         0x0000000000ae8f46 swift::TypeChecker::typeCheckTopLevelCodeDecl(swift::TopLevelCodeDecl*) + 134
16 sil-opt         0x0000000000a6de0d swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int) + 1581
17 sil-opt         0x0000000000739912 swift::CompilerInstance::performSema() + 2946
18 sil-opt         0x00000000007241dc main + 1916
Stack dump:
0.	Program arguments: sil-opt -enable-sil-verify-all
1.	While type-checking expression at [<stdin>:3:1 - line:3:8] RangeText="{(x:(x:("
```
2016-01-06 21:42:08 +01:00
practicalswift
25ca69f82a [SIL] Add test case for crash triggered in swift::Parser::parseExprIdentifier()
Stack trace:

```
<stdin>:3:16: error: expected '>' to complete generic parameter list
enum n{func p<p{p<@convention()>
               ^
<stdin>:3:14: note: to match this opening '<'
enum n{func p<p{p<@convention()>
             ^
<stdin>:3:16: error: expected '(' in argument list of function declaration
enum n{func p<p{p<@convention()>
               ^
<stdin>:3:31: error: expected convention name identifier in 'convention' attribute
enum n{func p<p{p<@convention()>
                              ^
<stdin>:3:32: error: expected type
enum n{func p<p{p<@convention()>
                               ^
<stdin>:3:18: note: while parsing this '<' as a type parameter bracket
enum n{func p<p{p<@convention()>
                 ^
sil-opt: /path/to/swift/include/swift/Basic/SourceLoc.h:93: swift::SourceRange::SourceRange(swift::SourceLoc, swift::SourceLoc): Assertion `Start.isValid() == End.isValid() && "Start and end should either both be valid or both be invalid!"' failed.
8  sil-opt         0x0000000000a2049a swift::Parser::parseExprIdentifier() + 1722
9  sil-opt         0x0000000000a1c363 swift::Parser::parseExprPostfix(swift::Diag<>, bool) + 515
10 sil-opt         0x0000000000a1afaa swift::Parser::parseExprSequence(swift::Diag<>, bool, bool) + 170
11 sil-opt         0x0000000000a1ae9f swift::Parser::parseExprImpl(swift::Diag<>, bool) + 191
12 sil-opt         0x0000000000a51054 swift::Parser::parseExprOrStmt(swift::ASTNode&) + 420
13 sil-opt         0x0000000000a52c56 swift::Parser::parseBraceItems(llvm::SmallVectorImpl<swift::ASTNode>&, swift::BraceItemListKind, swift::BraceItemListKind) + 1974
14 sil-opt         0x0000000000a573e0 swift::Parser::parseBraceItemList(swift::Diag<>) + 96
15 sil-opt         0x0000000000a11d61 swift::Parser::parseDeclFunc(swift::SourceLoc, swift::StaticSpellingKind, swift::OptionSet<swift::Parser::ParseDeclFlags, unsigned int>, swift::DeclAttributes&) + 3041
16 sil-opt         0x0000000000a093ba swift::Parser::parseDecl(llvm::SmallVectorImpl<swift::Decl*>&, swift::OptionSet<swift::Parser::ParseDeclFlags, unsigned int>) + 3306
18 sil-opt         0x00000000009fc0a3 swift::Parser::parseList(swift::tok, swift::SourceLoc, swift::SourceLoc&, swift::tok, bool, bool, swift::Diag<>, std::function<swift::ParserStatus ()>) + 723
19 sil-opt         0x0000000000a0d28e swift::Parser::parseDeclEnum(swift::OptionSet<swift::Parser::ParseDeclFlags, unsigned int>, swift::DeclAttributes&) + 1678
20 sil-opt         0x0000000000a0936b swift::Parser::parseDecl(llvm::SmallVectorImpl<swift::Decl*>&, swift::OptionSet<swift::Parser::ParseDeclFlags, unsigned int>) + 3227
21 sil-opt         0x0000000000a52c0e swift::Parser::parseBraceItems(llvm::SmallVectorImpl<swift::ASTNode>&, swift::BraceItemListKind, swift::BraceItemListKind) + 1902
22 sil-opt         0x00000000009fde5c swift::Parser::parseTopLevel() + 156
23 sil-opt         0x00000000009f931f swift::parseIntoSourceFile(swift::SourceFile&, unsigned int, bool*, swift::SILParserState*, swift::PersistentParserState*, swift::DelayedParsingCallbacks*) + 207
24 sil-opt         0x00000000007398f6 swift::CompilerInstance::performSema() + 2918
25 sil-opt         0x00000000007241dc main + 1916
Stack dump:
0.	Program arguments: sil-opt -enable-sil-verify-all
1.	With parser at source location: <stdin>:3:33
```
2016-01-05 14:58:32 +01:00
practicalswift
bebccb4e5d [SIL] Add test case for crash triggered in swift::TypeChecker::typeCheckDecl(swift::Decl*, bool)
Stack trace:

```
<stdin>:3:26: error: expected type
protocol P{var e:<T>()->(
                         ^
<stdin>:3:26: error: expected ',' separator
protocol P{var e:<T>()->(
                         ^
                         ,
<stdin>:3:26: error: consecutive declarations on a line must be separated by ';'
protocol P{var e:<T>()->(
                         ^
                         ;
<stdin>:3:26: error: expected declaration
protocol P{var e:<T>()->(
                         ^
sil-opt: /path/to/swift/lib/AST/Decl.cpp:1782: void swift::ValueDecl::setInterfaceType(swift::Type): Assertion `(type.isNull() || !type->is<PolymorphicFunctionType>()) && "setting polymorphic function type as interface type"' failed.
13 sil-opt         0x0000000000a9b8c7 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 151
14 sil-opt         0x0000000000a67012 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int) + 1474
15 sil-opt         0x0000000000738fc2 swift::CompilerInstance::performSema() + 2946
16 sil-opt         0x00000000007238ac main + 1916
Stack dump:
0.	Program arguments: sil-opt -enable-sil-verify-all
1.	While type-checking 'P' at <stdin>:3:1
```
2015-12-25 16:56:19 +01:00
practicalswift
c380936e4e [SIL] Add test case for crash triggered in swift::ModuleDecl::lookupConformance(swift::Type, swift::ProtocolDecl*, swift::LazyResolver*)
Stack trace:

```
<stdin>:3:12: error: expected '{' in enum
enum l<V>:V
           ^
<stdin>:3:6: error: missing protocol 'RawRepresentable'
enum l<V>:V
     ^
<stdin>:3:6: error: missing protocol 'IntegerLiteralConvertible'
enum l<V>:V
     ^
4  sil-opt         0x0000000000d5139a swift::ModuleDecl::lookupConformance(swift::Type, swift::ProtocolDecl*, swift::LazyResolver*) + 106
5  sil-opt         0x0000000000ac5da0 swift::TypeChecker::conformsToProtocol(swift::Type, swift::ProtocolDecl*, swift::DeclContext*, swift::OptionSet<swift::ConformanceCheckFlags, unsigned int>, swift::ProtocolConformance**, swift::SourceLoc) + 96
9  sil-opt         0x0000000000a9c0d7 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 151
10 sil-opt         0x0000000000a678aa swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int) + 1610
11 sil-opt         0x0000000000738d52 swift::CompilerInstance::performSema() + 2946
12 sil-opt         0x000000000072398c main + 1916
Stack dump:
0.	Program arguments: sil-opt -enable-sil-verify-all
1.	While type-checking 'l' at <stdin>:3:1
```
2015-12-23 12:21:31 +01:00
Dmitri Gribenko
6f30f8b2f0 Annotate a crash test as crashing in the AST verifier 2015-12-21 10:18:01 -07:00
Dmitri Gribenko
c7afd89674 Merge pull request #707 from practicalswift/sil-019-swift-parser-parseexprpostfix
[SIL] Add test case for crash triggered in swift::Parser::parseExprPostfix(…)
2015-12-21 08:44:51 -08:00
Dmitri Gribenko
706e038f13 Merge pull request #705 from practicalswift/sil-018-swift-valuedecl-getinterfacetype
[SIL] Add test case for crash triggered in swift::ValueDecl::getInterfaceType()
2015-12-21 08:39:53 -08:00
practicalswift
ac9d405f06 [SIL] Add test case for crash triggered in swift::Parser::parseExprPostfix(swift::Diag<>, bool)
Stack trace:

```
<stdin>:2:15: error: expected convention name identifier in 'convention' attribute
C<@convention()>{
              ^
<stdin>:2:16: error: expected type
C<@convention()>{
               ^
<stdin>:2:2: note: while parsing this '<' as a type parameter bracket
C<@convention()>{
 ^
<stdin>:2:18: error: expected '}' at end of closure
C<@convention()>{
                 ^
<stdin>:2:17: note: to match this opening '{'
C<@convention()>{
                ^
sil-opt: /path/to/swift/include/swift/Basic/SourceManager.h:184: std::pair<unsigned int, unsigned int> swift::SourceManager::getLineAndColumn(swift::SourceLoc, unsigned int) const: Assertion `Loc.isValid()' failed.
9  sil-opt         0x0000000000a15dec swift::Parser::parseExprPostfix(swift::Diag<>, bool) + 7628
10 sil-opt         0x0000000000a12e6a swift::Parser::parseExprSequence(swift::Diag<>, bool, bool) + 170
11 sil-opt         0x0000000000a12d5f swift::Parser::parseExprImpl(swift::Diag<>, bool) + 191
12 sil-opt         0x0000000000a495e4 swift::Parser::parseExprOrStmt(swift::ASTNode&) + 420
13 sil-opt         0x0000000000a4b09f swift::Parser::parseBraceItems(llvm::SmallVectorImpl<swift::ASTNode>&, swift::BraceItemListKind, swift::BraceItemListKind) + 1647
14 sil-opt         0x00000000009f5cbc swift::Parser::parseTopLevel() + 156
15 sil-opt         0x00000000009f123f swift::parseIntoSourceFile(swift::SourceFile&, unsigned int, bool*, swift::SILParserState*, swift::PersistentParserState*, swift::DelayedParsingCallbacks*) + 207
16 sil-opt         0x0000000000739206 swift::CompilerInstance::performSema() + 2918
17 sil-opt         0x0000000000723e5c main + 1916
Stack dump:
0.	Program arguments: sil-opt -enable-sil-verify-all
1.	With parser at source location: <stdin>:2:18
```
2015-12-21 13:34:32 +01:00
practicalswift
2fd839b7ba [SIL] Add test case for crash triggered in swift::ValueDecl::getInterfaceType() const
Stack trace:

```
<stdin>:3:25: error: expected '(' in argument list of function declaration
@objc protocol P{func t throw
                        ^
<stdin>:3:25: error: expected throwing specifier; did you mean 'throws'?
@objc protocol P{func t throw
                        ^~~~~
                        throws
<stdin>:3:30: error: consecutive declarations on a line must be separated by ';'
@objc protocol P{func t throw
                             ^
                             ;
<stdin>:3:30: error: expected declaration
@objc protocol P{func t throw
                             ^
4  sil-opt         0x0000000000d2488c swift::ValueDecl::getInterfaceType() const + 12
5  sil-opt         0x0000000000d25486 swift::TypeDecl::getDeclaredInterfaceType() const + 6
6  sil-opt         0x0000000000aea9bf swift::TypeChecker::isRepresentableInObjC(swift::AbstractFunctionDecl const*, swift::ObjCReason, llvm::Optional<swift::ForeignErrorConvention>&) + 1631
11 sil-opt         0x0000000000a9adb7 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 151
12 sil-opt         0x0000000000a665e2 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int) + 1474
13 sil-opt         0x0000000000739222 swift::CompilerInstance::performSema() + 2946
14 sil-opt         0x0000000000723e5c main + 1916
Stack dump:
0.	Program arguments: sil-opt -enable-sil-verify-all
1.	While type-checking 'P' at <stdin>:3:7
```
2015-12-21 11:27:46 +01:00
Dmitri Gribenko
0afd1d3ff8 Merge pull request #704 from practicalswift/sil-017-swift-decl-walk
[SIL] Add test case for crash triggered in swift::Decl::walk(…)
2015-12-21 00:15:50 -08:00
practicalswift
79dd392a4e [SIL] Add test case for crash triggered in swift::Decl::walk(swift::ASTWalker&)
Stack trace:

```
<stdin>:3:13: error: consecutive statements on a line must be separated by ';'
import Swift func g(@opened(Any
            ^
            ;
<stdin>:3:29: error: known id for 'opened' attribute must be a UUID string
import Swift func g(@opened(Any
                            ^
<stdin>:3:29: error: expected ')' after id value for 'opened' attribute
import Swift func g(@opened(Any
                            ^
<stdin>:3:28: note: to match this opening '('
import Swift func g(@opened(Any
                           ^
<stdin>:3:21: error: unnamed parameters must be written with the empty name '_'
import Swift func g(@opened(Any
                    ^
                    _:
<stdin>:3:32: error: expected ',' separator
import Swift func g(@opened(Any
                               ^
                               ,
<stdin>:3:32: error: expected parameter type following ':'
import Swift func g(@opened(Any
                               ^
<stdin>:3:32: error: expected ',' separator
import Swift func g(@opened(Any
                               ^
                               ,
Found opened existential archetype Any outside enclosing OpenExistentialExpr
15 sil-opt         0x0000000000ccd684 swift::Decl::walk(swift::ASTWalker&) + 20
16 sil-opt         0x0000000000d5600e swift::SourceFile::walk(swift::ASTWalker&) + 174
17 sil-opt         0x0000000000d85c44 swift::verify(swift::SourceFile&) + 52
18 sil-opt         0x0000000000a662cb swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int) + 1963
19 sil-opt         0x00000000007391c2 swift::CompilerInstance::performSema() + 2946
20 sil-opt         0x0000000000723dfc main + 1916
Stack dump:
0.	Program arguments: sil-opt -enable-sil-verify-all
1.	While walking into decl 'g' at <stdin>:3:14
2.	While walking into body of 'g' at <stdin>:3:14
```
2015-12-21 09:07:48 +01:00
Dmitri Gribenko
edfbf40f88 Merge pull request #703 from practicalswift/sil-016-swift-typechecker-typecheckfunctionbodyuntil
[SIL] Add test case for crash triggered in swift::TypeChecker::typeCheckFunctionBodyUntil(…)
2015-12-21 00:00:54 -08:00
practicalswift
a983bec48a [SIL] Add test case for crash triggered in swift::TypeChecker::typeCheckFunctionBodyUntil(swift::FuncDecl*, swift::SourceLoc)
Stack trace:

```
<stdin>:2:7: error: expected '(' in argument list of function declaration
func n->a{return:}class a
      ^
<stdin>:2:17: error: expected expression in 'return' statement
func n->a{return:}class a
                ^
<stdin>:2:19: error: consecutive statements on a line must be separated by ';'
func n->a{return:}class a
                  ^
                  ;
<stdin>:2:26: error: expected '{' in class
func n->a{return:}class a
                         ^
sil-opt: /path/to/llvm/include/llvm/Support/Casting.h:95: static bool llvm::isa_impl_cl<swift::ProtocolDecl, const swift::NominalTypeDecl *>::doit(const From *) [To = swift::ProtocolDecl, From = const swift::NominalTypeDecl *]: Assertion `Val && "isa<> used on a null pointer"' failed.
11 sil-opt         0x0000000000ae0d3b swift::TypeChecker::typeCheckFunctionBodyUntil(swift::FuncDecl*, swift::SourceLoc) + 379
12 sil-opt         0x0000000000ae0b7e swift::TypeChecker::typeCheckAbstractFunctionBodyUntil(swift::AbstractFunctionDecl*, swift::SourceLoc) + 46
13 sil-opt         0x0000000000ae17a8 swift::TypeChecker::typeCheckAbstractFunctionBody(swift::AbstractFunctionDecl*) + 136
15 sil-opt         0x0000000000a6620b swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int) + 1771
16 sil-opt         0x00000000007391c2 swift::CompilerInstance::performSema() + 2946
17 sil-opt         0x0000000000723dfc main + 1916
Stack dump:
0.	Program arguments: sil-opt -enable-sil-verify-all
1.	While type-checking 'n' at <stdin>:2:1
```
2015-12-21 08:56:27 +01:00
Dmitri Gribenko
b28e300024 Merge pull request #701 from practicalswift/sil-015-swift-parser-parsesilwitnesstable
[SIL] Add test case for crash triggered in swift::Parser::parseSILWitnessTable(…)
2015-12-20 23:42:39 -08:00
practicalswift
c592b66cc7 [SIL] Add test case for crash triggered in swift::Parser::parseSILWitnessTable()
Stack trace:

```
sil-opt: /path/to/swift/lib/Parse/ParseSIL.cpp:790: llvm::PointerUnion<ValueDecl *, Module *> lookupTopDecl(swift::Parser &, swift::Identifier): Assertion `DeclLookup.isSuccess() && DeclLookup.Results.size() == 1' failed.
11 sil-opt         0x0000000000a27272 swift::Parser::parseSILWitnessTable() + 450
12 sil-opt         0x00000000009f5a13 swift::Parser::parseTopLevel() + 755
13 sil-opt         0x00000000009f0d3f swift::parseIntoSourceFile(swift::SourceFile&, unsigned int, bool*, swift::SILParserState*, swift::PersistentParserState*, swift::DelayedParsingCallbacks*) + 207
14 sil-opt         0x00000000007391a6 swift::CompilerInstance::performSema() + 2918
15 sil-opt         0x0000000000723dfc main + 1916
Stack dump:
0.	Program arguments: sil-opt -enable-sil-verify-all
1.	With parser at source location: <stdin>:3:22
```
2015-12-21 08:39:31 +01:00
practicalswift
746a93b0e6 [SIL] Add test case for crash triggered in swift::SILDeclRef::SILDeclRef(swift::ValueDecl*, swift::SILDeclRef::Kind, swift::ResilienceExpansion, unsigned int, bool)
Stack trace:

```
<stdin>:3:8: error: expected '{' in class
class C}sil_vtable C{#C
       ^
<stdin>:3:8: error: extraneous '}' at top level
class C}sil_vtable C{#C
       ^

sil-opt: /path/to/swift/lib/SIL/SILDeclRef.cpp:144: swift::SILDeclRef::SILDeclRef(swift::ValueDecl *, SILDeclRef::Kind, swift::ResilienceExpansion, unsigned int, bool): Assertion `(kind == Kind::IVarInitializer || kind == Kind::IVarDestroyer) && "can only create ivar initializer/destroyer SILDeclRef for class"' failed.
8  sil-opt         0x00000000009cf6e6 swift::SILDeclRef::SILDeclRef(swift::ValueDecl*, swift::SILDeclRef::Kind, swift::ResilienceExpansion, unsigned int, bool) + 150
10 sil-opt         0x0000000000a26959 swift::Parser::parseSILVTable() + 905
11 sil-opt         0x00000000009f59e3 swift::Parser::parseTopLevel() + 707
12 sil-opt         0x00000000009f0d3f swift::parseIntoSourceFile(swift::SourceFile&, unsigned int, bool*, swift::SILParserState*, swift::PersistentParserState*, swift::DelayedParsingCallbacks*) + 207
13 sil-opt         0x00000000007391a6 swift::CompilerInstance::performSema() + 2918
14 sil-opt         0x0000000000723dfc main + 1916
Stack dump:
0.	Program arguments: sil-opt -enable-sil-verify-all
1.	With parser at source location: <stdin>:3:24
```
2015-12-21 07:37:02 +01:00
Dmitri Gribenko
9381b2099d Merge pull request #686 from practicalswift/sil-012-swift-dependentgenerictyperesolver-resolveselfassociatedtype
[SIL] Add test case for crash triggered in swift::DependentGenericTypeResolver::resolveSelfAssociatedType(…)
2015-12-20 15:12:12 -08:00
practicalswift
87008f24ad [SIL] Add test case for crash triggered in swift::Parser::parseSILGlobal()
Stack trace:

```
<stdin>:3:36: error: expected ']' or ',' in attribute list
sil_global@_a:$()sil_global[fragile@_a:$(
                                   ^
<stdin>:3:42: error: expected type
sil_global@_a:$()sil_global[fragile@_a:$(
                                         ^
<stdin>:3:42: error: expected ',' separator
sil_global@_a:$()sil_global[fragile@_a:$(
                                         ^
                                         ,
sil-opt: /path/to/swift/lib/SIL/SILGlobalVariable.cpp:29: static swift::SILGlobalVariable *swift::SILGlobalVariable::create(swift::SILModule &, swift::SILLinkage, bool, llvm::StringRef, swift::SILType, Optional<swift::SILLocation>, swift::VarDecl *): Assertion `!entry->getValue() && "global variable already exists"' failed.
9  sil-opt         0x0000000000a25f6c swift::Parser::parseSILGlobal() + 684
10 sil-opt         0x00000000009f5c3b swift::Parser::parseTopLevel() + 731
11 sil-opt         0x00000000009f0f7f swift::parseIntoSourceFile(swift::SourceFile&, unsigned int, bool*, swift::SILParserState*, swift::PersistentParserState*, swift::DelayedParsingCallbacks*) + 207
12 sil-opt         0x00000000007392a6 swift::CompilerInstance::performSema() + 2918
13 sil-opt         0x0000000000723efc main + 1916
Stack dump:
0.	Program arguments: sil-opt -enable-sil-verify-all
1.	With parser at source location: <stdin>:3:42
```
2015-12-20 22:08:36 +01:00
practicalswift
e48323ce10 [SIL] Add test case for crash triggered in swift::DependentGenericTypeResolver::resolveSelfAssociatedType(swift::Type, swift::DeclContext*, swift::AssociatedTypeDecl*)
Stack trace:

```
<stdin>:2:23: error: expected '>' to complete generic parameter list
protocol O{func f(<u,a{},a.i
                      ^
<stdin>:2:19: note: to match this opening '<'
protocol O{func f(<u,a{},a.i
                  ^
<stdin>:2:23: error: expected parameter type following ':'
protocol O{func f(<u,a{},a.i
                      ^
<stdin>:2:23: error: expected ',' separator
protocol O{func f(<u,a{},a.i
                      ^
                      ,
<stdin>:2:23: error: expected parameter type following ':'
protocol O{func f(<u,a{},a.i
                      ^
<stdin>:2:23: error: expected ',' separator
protocol O{func f(<u,a{},a.i
                      ^
                      ,
<stdin>:2:26: error: unnamed parameters must be written with the empty name '_'
protocol O{func f(<u,a{},a.i
                         ^
                         _:
<stdin>:2:29: error: expected ',' separator
protocol O{func f(<u,a{},a.i
                            ^
                            ,
<stdin>:2:29: error: expected parameter type following ':'
protocol O{func f(<u,a{},a.i
                            ^
<stdin>:2:29: error: expected ',' separator
protocol O{func f(<u,a{},a.i
                            ^
                            ,
<stdin>:2:29: error: consecutive declarations on a line must be separated by ';'
protocol O{func f(<u,a{},a.i
                            ^
                            ;
<stdin>:2:29: error: expected declaration
protocol O{func f(<u,a{},a.i
                            ^
<unknown>:0: error: type annotation missing in pattern
sil-opt: /path/to/swift/lib/Sema/TypeCheckGeneric.cpp:34: virtual swift::Type swift::DependentGenericTypeResolver::resolveDependentMemberType(swift::Type, swift::DeclContext *, swift::SourceRange, swift::ComponentIdentTypeRepr *): Assertion `archetype && "Bad generic context nesting?"' failed.
8  sil-opt         0x0000000000ab8550 swift::DependentGenericTypeResolver::resolveSelfAssociatedType(swift::Type, swift::DeclContext*, swift::AssociatedTypeDecl*) + 0
10 sil-opt         0x0000000000ae6bde swift::TypeChecker::resolveIdentifierType(swift::DeclContext*, swift::IdentTypeRepr*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, bool, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 158
12 sil-opt         0x0000000000ae6ad4 swift::TypeChecker::validateType(swift::TypeLoc&, swift::DeclContext*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 212
14 sil-opt         0x0000000000abeee1 swift::TypeChecker::typeCheckPattern(swift::Pattern*, swift::DeclContext*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, swift::GenericTypeResolver*) + 721
15 sil-opt         0x0000000000abee38 swift::TypeChecker::typeCheckPattern(swift::Pattern*, swift::DeclContext*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, swift::GenericTypeResolver*) + 552
17 sil-opt         0x0000000000ab91cc swift::TypeChecker::validateGenericFuncSignature(swift::AbstractFunctionDecl*) + 124
22 sil-opt         0x0000000000a9aaf7 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 151
23 sil-opt         0x0000000000a66322 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int) + 1474
24 sil-opt         0x00000000007392c2 swift::CompilerInstance::performSema() + 2946
25 sil-opt         0x0000000000723efc main + 1916
Stack dump:
0.	Program arguments: sil-opt -enable-sil-verify-all
1.	While type-checking 'O' at <stdin>:2:1
2.	While resolving type a.i at [<stdin>:2:26 - line:2:28] RangeText="a.i"
```
2015-12-20 13:55:04 +01:00
practicalswift
fbcbce263c [SIL] Add test case for crash triggered in llvm::llvm_unreachable_internal(char const*, char const*, unsigned int)
Stack trace:

```
<stdin>:2:22: error: expected ',' separator
sil@s:$()->(@owned T c:t
                     ^
                    ,
<stdin>:2:25: error: expected ',' separator
sil@s:$()->(@owned T c:t
                        ^
                        ,
<stdin>:2:25: error: expected type
sil@s:$()->(@owned T c:t
                        ^
<stdin>:2:25: error: expected ',' separator
sil@s:$()->(@owned T c:t
                        ^
                        ,
<stdin>:2:20: error: use of undeclared type 'T'
sil@s:$()->(@owned T c:t
                   ^
NamedTypeRepr only shows up as an element of Tuple
UNREACHABLE executed at /path/to/swift/lib/Sema/TypeCheckType.cpp:1400!
6  sil-opt         0x0000000002c0db6d llvm::llvm_unreachable_internal(char const*, char const*, unsigned int) + 461
12 sil-opt         0x0000000000ae6ad4 swift::TypeChecker::validateType(swift::TypeLoc&, swift::DeclContext*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 212
13 sil-opt         0x0000000000a66c0f swift::performTypeLocChecking(swift::ASTContext&, swift::TypeLoc&, bool, swift::DeclContext*, bool) + 1007
15 sil-opt         0x0000000000a23113 swift::Parser::parseDeclSIL() + 627
16 sil-opt         0x00000000009f5ada swift::Parser::parseTopLevel() + 378
17 sil-opt         0x00000000009f0f7f swift::parseIntoSourceFile(swift::SourceFile&, unsigned int, bool*, swift::SILParserState*, swift::PersistentParserState*, swift::DelayedParsingCallbacks*) + 207
18 sil-opt         0x00000000007392a6 swift::CompilerInstance::performSema() + 2918
19 sil-opt         0x0000000000723efc main + 1916
Stack dump:
0.	Program arguments: sil-opt -enable-sil-verify-all
1.	With parser at source location: <stdin>:2:25
2.	While resolving type @convention(thin) () -> ( T, c: t)sil-opt: /path/to/swift/include/swift/Basic/SourceLoc.h:93: swift::SourceRange::SourceRange(swift::SourceLoc, swift::SourceLoc): Assertion `Start.isValid() == End.isValid() && "Start and end should either both be valid or both be invalid!"' failed.
```
2015-12-20 12:22:27 +01:00
Dmitri Gribenko
d9802dd59b Annotate a test as crashing in the AST verifier 2015-12-19 17:50:24 -07:00
Dmitri Gribenko
77db095be5 Merge pull request #675 from practicalswift/sil-010-swift-typechecker-addimplicitconstructors
[SIL] Add test case for crash triggered in swift::TypeChecker::addImplicitConstructors(…)
2015-12-19 16:27:30 -08:00
practicalswift
252774ba51 [SIL] Add test case for crash triggered in swift::TypeChecker::addImplicitConstructors(swift::NominalTypeDecl*)
Stack trace:

```
<stdin>:4:6: error: consecutive declarations on a line must be separated by ';'
var h
     ^
     ;
<stdin>:4:6: error: expected declaration
var h
     ^
<stdin>:3:24: error: type annotation missing in pattern
class C{@NSManaged var S
                       ^
<stdin>:4:5: error: type annotation missing in pattern
var h
    ^
<stdin>:3:7: error: class 'C' has no initializers
class C{@NSManaged var S
      ^
sil-opt: /path/to/swift/lib/Sema/TypeCheckDecl.cpp:1010: auto isNeverDefaultInitializable(swift::Pattern *)::(anonymous class)::operator()(swift::VarDecl *) const: Assertion `!var->getAttrs().hasAttribute<NSManagedAttr>()' failed.
11 sil-opt         0x0000000000a9ff1f swift::TypeChecker::addImplicitConstructors(swift::NominalTypeDecl*) + 1359
14 sil-opt         0x0000000000a9aba7 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 151
15 sil-opt         0x0000000000a663fa swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int) + 1610
16 sil-opt         0x00000000007392c2 swift::CompilerInstance::performSema() + 2946
17 sil-opt         0x0000000000723efc main + 1916
Stack dump:
0.	Program arguments: sil-opt -enable-sil-verify-all
1.	While type-checking 'C' at <stdin>:3:1
```
2015-12-20 01:16:41 +01:00
Dmitri Gribenko
3330352a47 Merge pull request #670 from practicalswift/additional-bash-fixes
Cleanups of various bash scripts
2015-12-19 16:10:34 -08:00
Dmitri Gribenko
054874e763 Merge pull request #666 from practicalswift/sil-008-swift-genericparamlist-getasgenericsignatureelements
[SIL] Add test case for crash triggered in swift::GenericParamList::getAsGenericSignatureElements(…)
2015-12-19 16:04:01 -08:00
Dmitri Gribenko
f6371591e7 Merge pull request #671 from practicalswift/sil-009-swift-parser-parsedeclsil
[SIL] Add test case for crash triggered in swift::Parser::parseDeclSIL()
2015-12-19 15:22:21 -08:00