Commit Graph

1304 Commits

Author SHA1 Message Date
practicalswift
681c6ac059 Merge pull request #3693 from practicalswift/swiftc-28375-swift-typechecker-lookupmembertype
[swiftc (71 vs. 5114)] Add crasher in swift::TypeChecker::lookupMemberType(...)
2016-07-23 05:37:24 +02:00
Jordan Rose
c98a855dbb Rework access checking in terms of "access scopes", and default to 'internal'
Merge pull request #3506 from jrose-apple/private-and-fileprivate

More progress on SE-0025.
2016-07-22 17:27:52 -07:00
practicalswift
a3c2f8be5b [swiftc (71 vs. 5114)] Add crasher in swift::TypeChecker::lookupMemberType(...)
Add test case for crash triggered in `swift::TypeChecker::lookupMemberType(...)`.

Current number of unresolved compiler crashers: 71 (5114 resolved)

Assertion failure in [`lib/Sema/TypeCheckNameLookup.cpp (line 328)`](https://github.com/apple/swift/blob/master/lib/Sema/TypeCheckNameLookup.cpp#L328):

```
Assertion `!type->isTypeParameter()' failed.

When executing: swift::LookupTypeResult swift::TypeChecker::lookupMemberType(swift::DeclContext *, swift::Type, swift::Identifier, NameLookupOptions)
```

Assertion context:

```
  // Look through the metatype.
  if (auto metaT = type->getAs<AnyMetatypeType>())
    type = metaT->getInstanceType();

  // Callers must cope with dependent types directly.
  assert(!type->isTypeParameter());

  // Look for members with the given name.
  SmallVector<ValueDecl *, 4> decls;
  NLOptions subOptions = NL_QualifiedDefault | NL_OnlyTypes;

```
Stack trace:

```
swift: /path/to/swift/lib/Sema/TypeCheckNameLookup.cpp:328: swift::LookupTypeResult swift::TypeChecker::lookupMemberType(swift::DeclContext *, swift::Type, swift::Identifier, NameLookupOptions): Assertion `!type->isTypeParameter()' failed.
8  swift           0x0000000000f06e74 swift::TypeChecker::lookupMemberType(swift::DeclContext*, swift::Type, swift::Identifier, swift::OptionSet<swift::NameLookupFlags, unsigned int>) + 1572
10 swift           0x0000000000f3800e swift::TypeChecker::resolveIdentifierType(swift::DeclContext*, swift::IdentTypeRepr*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, bool, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 158
12 swift           0x0000000000f38f64 swift::TypeChecker::resolveType(swift::TypeRepr*, swift::DeclContext*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 164
13 swift           0x0000000000f37f00 swift::TypeChecker::validateType(swift::TypeLoc&, swift::DeclContext*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 192
15 swift           0x0000000000f01b9e swift::TypeChecker::validateGenericFuncSignature(swift::AbstractFunctionDecl*) + 94
18 swift           0x0000000000ec41c3 swift::TypeChecker::validateDecl(swift::ValueDecl*, bool) + 947
23 swift           0x00000000011057b5 swift::lookupVisibleDecls(swift::VisibleDeclConsumer&, swift::DeclContext const*, swift::LazyResolver*, bool, swift::SourceLoc) + 1189
24 swift           0x0000000000f07102 swift::TypeChecker::performTypoCorrection(swift::DeclContext*, swift::DeclRefKind, swift::Type, swift::DeclName, swift::SourceLoc, swift::OptionSet<swift::NameLookupFlags, unsigned int>, swift::LookupResult&, unsigned int) + 290
25 swift           0x0000000000eafee9 swift::TypeChecker::resolveDeclRefExpr(swift::UnresolvedDeclRefExpr*, swift::DeclContext*) + 3865
27 swift           0x000000000108188b swift::Expr::walk(swift::ASTWalker&) + 27
28 swift           0x0000000000eb0770 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
29 swift           0x0000000000eb75ad swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*, swift::constraints::ConstraintSystem*) + 621
30 swift           0x0000000000eb8760 swift::TypeChecker::typeCheckBinding(swift::Pattern*&, swift::Expr*&, swift::DeclContext*) + 352
31 swift           0x0000000000eb897b swift::TypeChecker::typeCheckPatternBinding(swift::PatternBindingDecl*, unsigned int) + 267
35 swift           0x0000000000ec95b6 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 150
38 swift           0x0000000000f31f44 swift::TypeChecker::typeCheckClosureBody(swift::ClosureExpr*) + 244
39 swift           0x0000000000f5da0c swift::constraints::ConstraintSystem::applySolution(swift::constraints::Solution&, swift::Expr*, swift::Type, bool, bool, bool) + 876
40 swift           0x0000000000eb764a swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*, swift::constraints::ConstraintSystem*) + 778
42 swift           0x0000000000f32086 swift::TypeChecker::typeCheckTopLevelCodeDecl(swift::TopLevelCodeDecl*) + 134
43 swift           0x0000000000eebe4d swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) + 1133
44 swift           0x0000000000c735c9 swift::CompilerInstance::performSema() + 3289
46 swift           0x00000000007d9277 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2887
47 swift           0x00000000007a5278 main + 2872
Stack dump:
0.	Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28375-swift-typechecker-lookupmembertype.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28375-swift-typechecker-lookupmembertype-f72c36.o
1.	While type-checking expression at [validation-test/compiler_crashers/28375-swift-typechecker-lookupmembertype.swift:10:1 - line:11:15] RangeText="{struct S<T{var:e=d func g:e.a
2.	While type-checking 'S' at validation-test/compiler_crashers/28375-swift-typechecker-lookupmembertype.swift:10:2
3.	While type-checking expression at [validation-test/compiler_crashers/28375-swift-typechecker-lookupmembertype.swift:10:19 - line:10:19] RangeText="d"
4.	While type-checking 'g' at validation-test/compiler_crashers/28375-swift-typechecker-lookupmembertype.swift:10:21
5.	While resolving type e.a at [validation-test/compiler_crashers/28375-swift-typechecker-lookupmembertype.swift:10:28 - line:10:30] RangeText="e.a"
<unknown>:0: error: unable to execute command: Aborted
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
```
2016-07-23 00:27:25 +02:00
practicalswift
8b52544365 [swiftc (70 vs. 5114)] Add crasher in swift::TypeChecker::resolveWitness(...)
Add test case for crash triggered in `swift::TypeChecker::resolveWitness(...)`.

Current number of unresolved compiler crashers: 70 (5114 resolved)

Assertion failure in [`lib/Sema/TypeCheckProtocol.cpp (line 1813)`](https://github.com/apple/swift/blob/master/lib/Sema/TypeCheckProtocol.cpp#L1813):

```
Assertion `(archetype != nullptr || isError) && "Should have built archetypes already"' failed.

When executing: swift::Substitution getArchetypeSubstitution(swift::TypeChecker &, swift::DeclContext *, swift::ArchetypeType *, swift::Type)
```

Assertion context:

```
  assert(!resultReplacement->isTypeParameter() && "Can't be dependent");
  SmallVector<ProtocolConformanceRef, 4> conformances;

  bool isError = replacement->is<ErrorType>();
  assert((archetype != nullptr || isError) &&
         "Should have built archetypes already");

  // FIXME: Turn the nullptr check into an assertion
  if (archetype != nullptr) {
    for (auto proto : archetype->getConformsTo()) {
      ProtocolConformance *conformance = nullptr;
```
Stack trace:

```
swift: /path/to/swift/lib/Sema/TypeCheckProtocol.cpp:1813: swift::Substitution getArchetypeSubstitution(swift::TypeChecker &, swift::DeclContext *, swift::ArchetypeType *, swift::Type): Assertion `(archetype != nullptr || isError) && "Should have built archetypes already"' failed.
11 swift           0x0000000000f13609 swift::TypeChecker::resolveWitness(swift::NormalProtocolConformance const*, swift::ValueDecl*) + 569
12 swift           0x000000000113001b swift::NormalProtocolConformance::getWitness(swift::ValueDecl*, swift::LazyResolver*) const + 171
14 swift           0x0000000000f05d24 swift::TypeChecker::lookupUnqualified(swift::DeclContext*, swift::DeclName, swift::SourceLoc, swift::OptionSet<swift::NameLookupFlags, unsigned int>) + 404
15 swift           0x0000000000eaf03c swift::TypeChecker::resolveDeclRefExpr(swift::UnresolvedDeclRefExpr*, swift::DeclContext*) + 108
17 swift           0x000000000108188b swift::Expr::walk(swift::ASTWalker&) + 27
18 swift           0x0000000000eb0770 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
19 swift           0x0000000000eb75ad swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*, swift::constraints::ConstraintSystem*) + 621
20 swift           0x0000000000eb8760 swift::TypeChecker::typeCheckBinding(swift::Pattern*&, swift::Expr*&, swift::DeclContext*) + 352
21 swift           0x0000000000eb897b swift::TypeChecker::typeCheckPatternBinding(swift::PatternBindingDecl*, unsigned int) + 267
23 swift           0x0000000000ec4d1d swift::TypeChecker::validateDecl(swift::ValueDecl*, bool) + 3853
29 swift           0x0000000000ec95b6 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 150
30 swift           0x0000000000eebde2 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) + 1026
31 swift           0x0000000000c735c9 swift::CompilerInstance::performSema() + 3289
33 swift           0x00000000007d9277 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2887
34 swift           0x00000000007a5278 main + 2872
Stack dump:
0.	Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28374-swift-typechecker-resolvewitness.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28374-swift-typechecker-resolvewitness-9c17ae.o
1.	While type-checking 'a' at validation-test/compiler_crashers/28374-swift-typechecker-resolvewitness.swift:10:1
2.	While type-checking expression at [validation-test/compiler_crashers/28374-swift-typechecker-resolvewitness.swift:15:7 - line:15:7] RangeText="B"
<unknown>:0: error: unable to execute command: Aborted
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
```
2016-07-22 23:01:02 +02:00
practicalswift
0c5156da43 [swiftc (69 vs. 5114)] Add crasher in swift::PrintOptions::setArchetypeSelfTransform(...)
Add test case for crash triggered in `swift::PrintOptions::setArchetypeSelfTransform(...)`.

Current number of unresolved compiler crashers: 69 (5114 resolved)

Assertion failure in [`lib/AST/ASTPrinter.cpp (line 68)`](https://github.com/apple/swift/blob/master/lib/AST/ASTPrinter.cpp#L68):

```
Assertion `ParamDecls.size() == Args.size()' failed.

When executing: std::unique_ptr<llvm::DenseMap<StringRef, Type> > swift::collectNameTypeMap(swift::Type)
```

Assertion context:

```
    if (!D || !D->getGenericParams())
      continue;
    SmallVector<Type, 3> Scrach;
    auto Args = BaseTy->getAllGenericArgs(Scrach);
    const auto ParamDecls = D->getGenericParams()->getParams();
    assert(ParamDecls.size() == Args.size());

    // Map type parameter names with their instantiating arguments.
    for (unsigned I = 0, N = ParamDecls.size(); I < N; I++) {
      (*IdMap)[ParamDecls[I]->getName().str()] = Args[I];
    }
```
Stack trace:

```
swift: /path/to/swift/lib/AST/ASTPrinter.cpp:68: std::unique_ptr<llvm::DenseMap<StringRef, Type> > swift::collectNameTypeMap(swift::Type): Assertion `ParamDecls.size() == Args.size()' failed.
9  swift           0x000000000104a240 swift::PrintOptions::setArchetypeSelfTransform(swift::Type, swift::DeclContext*) + 144
13 swift           0x0000000000f10f97 swift::TypeChecker::checkConformance(swift::NormalProtocolConformance*) + 2423
15 swift           0x0000000000eebee1 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) + 1281
16 swift           0x0000000000c735c9 swift::CompilerInstance::performSema() + 3289
18 swift           0x00000000007d9277 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2887
19 swift           0x00000000007a5278 main + 2872
Stack dump:
0.	Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28373-swift-printoptions-setarchetypeselftransform.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28373-swift-printoptions-setarchetypeselftransform-d50673.o
<unknown>:0: error: unable to execute command: Aborted
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
```
2016-07-22 19:38:38 +02:00
practicalswift
3d7047e3bf Merge pull request #3669 from practicalswift/swiftc-28372-swift-printoptions-setarchetypeanddynamicselftransform
[swiftc (72 vs. 5110)] Add crasher in swift::PrintOptions::setArchetypeAndDynamicSelfTransform(...)
2016-07-22 17:40:15 +02:00
practicalswift
2de82e5b8f [swiftc (72 vs. 5110)] Add crasher in swift::PrintOptions::setArchetypeAndDynamicSelfTransform(...)
Add test case for crash triggered in `swift::PrintOptions::setArchetypeAndDynamicSelfTransform(...)`.

Current number of unresolved compiler crashers: 72 (5110 resolved)

Assertion failure in [`lib/AST/ASTPrinter.cpp (line 68)`](https://github.com/apple/swift/blob/master/lib/AST/ASTPrinter.cpp#L68):

```
Assertion `ParamDecls.size() == Args.size()' failed.

When executing: std::unique_ptr<llvm::DenseMap<StringRef, Type> > swift::collectNameTypeMap(swift::Type)
```

Assertion context:

```
    if (!D || !D->getGenericParams())
      continue;
    SmallVector<Type, 3> Scrach;
    auto Args = BaseTy->getAllGenericArgs(Scrach);
    const auto ParamDecls = D->getGenericParams()->getParams();
    assert(ParamDecls.size() == Args.size());

    // Map type parameter names with their instantiating arguments.
    for (unsigned I = 0, N = ParamDecls.size(); I < N; I++) {
      (*IdMap)[ParamDecls[I]->getName().str()] = Args[I];
    }
```
Stack trace:

```
swift: /path/to/swift/lib/AST/ASTPrinter.cpp:68: std::unique_ptr<llvm::DenseMap<StringRef, Type> > swift::collectNameTypeMap(swift::Type): Assertion `ParamDecls.size() == Args.size()' failed.
9  swift           0x000000000104b5d2 swift::PrintOptions::setArchetypeAndDynamicSelfTransform(swift::Type, swift::DeclContext*) + 130
13 swift           0x0000000000f11a57 swift::TypeChecker::checkConformance(swift::NormalProtocolConformance*) + 2423
14 swift           0x0000000000f11ec7 swift::TypeChecker::checkConformancesInContext(swift::DeclContext*, swift::IterableDeclContext*) + 471
19 swift           0x0000000000ec9ab6 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 150
22 swift           0x0000000000f32a64 swift::TypeChecker::typeCheckClosureBody(swift::ClosureExpr*) + 244
23 swift           0x0000000000f5e7ac swift::constraints::ConstraintSystem::applySolution(swift::constraints::Solution&, swift::Expr*, swift::Type, bool, bool, bool) + 876
24 swift           0x0000000000eb7b41 swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*) + 769
26 swift           0x0000000000f32ba6 swift::TypeChecker::typeCheckTopLevelCodeDecl(swift::TopLevelCodeDecl*) + 134
27 swift           0x0000000000eec48d swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) + 1133
28 swift           0x0000000000c73849 swift::CompilerInstance::performSema() + 3289
30 swift           0x00000000007d95c7 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2887
31 swift           0x00000000007a55c8 main + 2872
Stack dump:
0.	Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28372-swift-printoptions-setarchetypeanddynamicselftransform.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28372-swift-printoptions-setarchetypeanddynamicselftransform-7809a8.o
1.	While type-checking expression at [validation-test/compiler_crashers/28372-swift-printoptions-setarchetypeanddynamicselftransform.swift:10:1 - line:12:11] RangeText="{protocol a{
2.	While type-checking 'a' at validation-test/compiler_crashers/28372-swift-printoptions-setarchetypeanddynamicselftransform.swift:10:2
<unknown>:0: error: unable to execute command: Aborted
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
```
2016-07-22 00:03:34 +02:00
Jordan Rose
758cf64283 Rework access checking in terms of "access scopes".
(in preparation for the private/fileprivate split)

An "access scope" is the outermost DeclContext where a particular
declaration may be referenced: for a 'fileprivate' declaration it's
the enclosing file, and for an 'internal' declaration it's the module.
'public' corresponds to a scope of "everything", represented by a null
DeclContext.

This model extends naturally to the (not-yet-implemented) SE-0025
notion of 'private', where the access scope is a declaration's
immediately enclosing DeclContext.

Complicating this model is the revised rules that allow, e.g., a public
declaration to be declared within an internal type. The access scope
for this declaration is still just the module, not "everything".

This commit reworks formal access control checking in terms of this
model, including tightening up some of the handling for '@testable'.
This implements the rule that you must be able to access a declaration's
type everywhere you can reference the declaration.

This was not intended to change compiler behavior, but in practice it
has made cross-file dependency tracking a bit more conservative
(unnecessarily), caught a mistake in diagnosing access violations,
and fixed a fuzzer-based crasher (see test changes).

Progress on SE-0025 ('private' and 'fileprivate')
2016-07-21 14:54:48 -07:00
Doug Gregor
c56f96d237 [Type checker] Synthesize member operator '==' for Equatable enums.
Rather than synthesizing a global operator '==' for Equatable enums,
synthesize a member operator, which is more idiomatic and much
cleaner.

To make sure that these synthesized operators can actually be found,
start considering operator requirements in protocols
more generally in the type checker, so that, e.g., "myEnum == myEnum"
will type-check against Equatable.== and, on successful type-check,
will call the (newly-synthesized) witness for '=='. This both makes it
easier to make sure we find the operators in, e.g., complex multi-file
and lazy-type checking scenarios, and is a step toward the
type-checking improvements described in SE-0091.
2016-07-21 12:54:27 -07:00
swift-ci
a766e6f2d7 Merge pull request #2843 from ahoppen/SR-1236-errors 2016-07-21 10:53:11 -07:00
practicalswift
a820296cfc [swiftc (72 vs. 5109)] Add crasher in swift::GenericParamList::getSubstitutionMap(...)
Add test case for crash triggered in `swift::GenericParamList::getSubstitutionMap(...)`.

Current number of unresolved compiler crashers: 72 (5109 resolved)

Assertion failure in `llvm/include/llvm/ADT/ArrayRef.h (line 139)`:

```
Assertion `!empty()' failed.

When executing: const T &llvm::ArrayRef<swift::Substitution>::front() const [T = swift::Substitution]
```

Assertion context:

```
    /// size - Get the array size.
    size_t size() const { return Length; }

    /// front - Get the first element.
    const T &front() const {
      assert(!empty());
      return Data[0];
    }

    /// back - Get the last element.
    const T &back() const {
```
Stack trace:

```
swift: /path/to/llvm/include/llvm/ADT/ArrayRef.h:139: const T &llvm::ArrayRef<swift::Substitution>::front() const [T = swift::Substitution]: Assertion `!empty()' failed.
8  swift           0x0000000001136748 swift::GenericParamList::getSubstitutionMap(llvm::ArrayRef<swift::Substitution>) const + 1080
9  swift           0x0000000001127b57 swift::SpecializedProtocolConformance::getTypeWitnessSubstAndDecl(swift::AssociatedTypeDecl*, swift::LazyResolver*) const + 215
10 swift           0x0000000001127862 swift::ProtocolConformance::getTypeWitnessSubstAndDecl(swift::AssociatedTypeDecl*, swift::LazyResolver*) const + 18
11 swift           0x0000000001128046 swift::ProtocolConformance::getTypeWitness(swift::AssociatedTypeDecl*, swift::LazyResolver*) const + 6
12 swift           0x0000000000f32531 swift::TypeChecker::resolveTypeInContext(swift::TypeDecl*, swift::DeclContext*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, bool, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 2401
16 swift           0x0000000000f3362e swift::TypeChecker::resolveIdentifierType(swift::DeclContext*, swift::IdentTypeRepr*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, bool, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 158
18 swift           0x0000000000f34584 swift::TypeChecker::resolveType(swift::TypeRepr*, swift::DeclContext*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 164
19 swift           0x0000000000f33520 swift::TypeChecker::validateType(swift::TypeLoc&, swift::DeclContext*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 192
21 swift           0x0000000000efd7be swift::TypeChecker::validateGenericFuncSignature(swift::AbstractFunctionDecl*) + 94
28 swift           0x0000000000ec55e6 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 150
31 swift           0x0000000000f2d5e4 swift::TypeChecker::typeCheckClosureBody(swift::ClosureExpr*) + 244
32 swift           0x0000000000f593ac swift::constraints::ConstraintSystem::applySolution(swift::constraints::Solution&, swift::Expr*, swift::Type, bool, bool, bool) + 876
33 swift           0x0000000000eb3c81 swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*) + 769
35 swift           0x0000000000f2d726 swift::TypeChecker::typeCheckTopLevelCodeDecl(swift::TopLevelCodeDecl*) + 134
36 swift           0x0000000000ee77cd swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) + 1133
37 swift           0x0000000000c71a09 swift::CompilerInstance::performSema() + 3289
39 swift           0x00000000007d91c9 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2857
40 swift           0x00000000007a51e8 main + 2872
Stack dump:
0.	Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28371-swift-genericparamlist-getsubstitutionmap.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28371-swift-genericparamlist-getsubstitutionmap-a3baf5.o
1.	While type-checking expression at [validation-test/compiler_crashers/28371-swift-genericparamlist-getsubstitutionmap.swift:10:1 - line:10:58] RangeText="{protocol a{protocol b>class B<g:b>:a{func d:e}typealias e"
2.	While type-checking 'a' at validation-test/compiler_crashers/28371-swift-genericparamlist-getsubstitutionmap.swift:10:2
3.	While resolving type e at [validation-test/compiler_crashers/28371-swift-genericparamlist-getsubstitutionmap.swift:10:46 - line:10:46] RangeText="e"
<unknown>:0: error: unable to execute command: Aborted
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
```
2016-07-21 00:03:06 +02:00
Alex Hoppen
095a68b195 [Sema] Disallow accessing enum elements as instance members
This implements SE-0036.
2016-07-20 19:13:58 +02:00
practicalswift
82af6ffc80 [swiftc (71 vs. 5109)] Add crasher in swift::decomposeParamType(...)
Add test case for crash triggered in `swift::decomposeParamType(...)`.

Current number of unresolved compiler crashers: 71 (5109 resolved)

Assertion failure in `llvm/include/llvm/ADT/ArrayRef.h (line 186)`:

```
Assertion `Index < Length && "Invalid index!"' failed.

When executing: const T &llvm::ArrayRef<swift::ParamDecl *>::operator[](size_t) const [T = swift::ParamDecl *]
```

Assertion context:

```

    /// @}
    /// @name Operator Overloads
    /// @{
    const T &operator[](size_t Index) const {
      assert(Index < Length && "Invalid index!");
      return Data[Index];
    }

    /// @}
    /// @name Expensive Operations
```
Stack trace:

```
swift: /path/to/llvm/include/llvm/ADT/ArrayRef.h:186: const T &llvm::ArrayRef<swift::ParamDecl *>::operator[](size_t) const [T = swift::ParamDecl *]: Assertion `Index < Length && "Invalid index!"' failed.
8  swift           0x0000000001131544 swift::decomposeParamType(swift::Type, swift::ValueDecl const*, unsigned int) + 708
12 swift           0x0000000000f75433 swift::constraints::ConstraintSystem::diagnoseFailureForExpr(swift::Expr*) + 99
13 swift           0x0000000000f7aabe swift::constraints::ConstraintSystem::salvage(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::Expr*) + 3998
14 swift           0x0000000000ead422 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>) + 850
15 swift           0x0000000000eb3be2 swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*) + 610
18 swift           0x0000000000f2c25a swift::TypeChecker::typeCheckFunctionBodyUntil(swift::FuncDecl*, swift::SourceLoc) + 346
19 swift           0x0000000000f2c0be swift::TypeChecker::typeCheckAbstractFunctionBodyUntil(swift::AbstractFunctionDecl*, swift::SourceLoc) + 46
20 swift           0x0000000000f2cc83 swift::TypeChecker::typeCheckAbstractFunctionBody(swift::AbstractFunctionDecl*) + 179
22 swift           0x0000000000ee7861 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) + 1281
23 swift           0x0000000000c71a09 swift::CompilerInstance::performSema() + 3289
25 swift           0x00000000007d91c9 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2857
26 swift           0x00000000007a51e8 main + 2872
Stack dump:
0.	Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28370-swift-decomposeparamtype.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28370-swift-decomposeparamtype-654b39.o
1.	While type-checking 'c' at validation-test/compiler_crashers/28370-swift-decomposeparamtype.swift:11:1
2.	While type-checking expression at [validation-test/compiler_crashers/28370-swift-decomposeparamtype.swift:11:10 - line:11:11] RangeText="c("
<unknown>:0: error: unable to execute command: Aborted
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
```
2016-07-20 18:08:11 +02:00
practicalswift
d10ea6ef75 Merge pull request #3588 from practicalswift/28369-swift-decl-walk.swift
[swiftc] Add non-fuzzing crash case submitted by @kiliankoe
2016-07-20 18:01:34 +02:00
practicalswift
2cc72da9a0 Further reduction thanks to @jtbandes 2016-07-20 00:47:41 +02:00
Doug Gregor
80f0852504 [SE-0091] Allow 'static' operators to be declared within types and extensions thereof.
Allow 'static' (or, in classes, final 'class') operators to be
declared within types and extensions thereof. Within protocols,
require operators to be marked 'static'. Use a warning with a Fix-It
to stage this in, so we don't break the world's code.

Protocol conformance checking already seems to work, so add some tests
for that. Update a pile of tests and the standard library to include
the required 'static' keywords.

There is an amusing name-mangling change here. Global operators were
getting marked as 'static' (for silly reasons), so their mangled names
had the 'Z' modifier for static methods, even though this doesn't make
sense. Now, operators within types and extensions need to be 'static'
as written.
2016-07-18 23:18:57 -07:00
practicalswift
a1539f5331 [swiftc] Add non-fuzzing crash case submitted by @kiliankoe
Credits: https://twitter.com/kiliankoe/status/752090953977036800
2016-07-18 23:43:35 +02:00
practicalswift
fd8faa579d [swiftc (70 vs. 5108)] Add crasher in swift::Expr::propagateLValueAccessKind(...)
Add test case for crash triggered in `swift::Expr::propagateLValueAccessKind(...)`.

Current number of unresolved compiler crashers: 70 (5108 resolved)

Stack trace:

```
6  swift           0x00000000032c80ad llvm::llvm_unreachable_internal(char const*, char const*, unsigned int) + 461
8  swift           0x00000000010f4c67 swift::Expr::propagateLValueAccessKind(swift::AccessKind, bool) + 23
12 swift           0x000000000107c7d5 swift::Expr::walk(swift::ASTWalker&) + 69
13 swift           0x0000000000f5bed2 swift::constraints::ConstraintSystem::applySolution(swift::constraints::Solution&, swift::Expr*, swift::Type, bool, bool, bool) + 514
14 swift           0x0000000000eb6971 swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*) + 769
17 swift           0x0000000000f7b572 swift::constraints::ConstraintSystem::diagnoseFailureForExpr(swift::Expr*) + 13586
18 swift           0x0000000000f7d74e swift::constraints::ConstraintSystem::salvage(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::Expr*) + 3998
19 swift           0x0000000000eb0112 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>) + 850
20 swift           0x0000000000eb68d2 swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*) + 610
21 swift           0x0000000000eb7a87 swift::TypeChecker::typeCheckBinding(swift::Pattern*&, swift::Expr*&, swift::DeclContext*) + 343
22 swift           0x0000000000eb8785 swift::TypeChecker::typeCheckStmtCondition(llvm::MutableArrayRef<swift::StmtConditionElement>&, swift::DeclContext*, swift::Diag<>) + 373
25 swift           0x0000000000f303b6 swift::TypeChecker::typeCheckTopLevelCodeDecl(swift::TopLevelCodeDecl*) + 134
26 swift           0x0000000000eea4bd swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) + 1133
27 swift           0x0000000000c6f629 swift::CompilerInstance::performSema() + 3289
29 swift           0x00000000007d8f39 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2857
30 swift           0x00000000007a4f58 main + 2872
Stack dump:
0.	Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28368-swift-expr-propagatelvalueaccesskind.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28368-swift-expr-propagatelvalueaccesskind-c5a6ea.o
1.	While type-checking expression at [validation-test/compiler_crashers/28368-swift-expr-propagatelvalueaccesskind.swift:9:13 - line:9:19] RangeText=".h.a=[]"
2.	While type-checking expression at [validation-test/compiler_crashers/28368-swift-expr-propagatelvalueaccesskind.swift:9:13 - line:9:19] RangeText=".h.a=[]"
<unknown>:0: error: unable to execute command: Aborted
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
```
2016-07-18 10:50:16 +02:00
practicalswift
0a3666e72b [swiftc (69 vs. 5108)] Add crasher in swift::DeclContext::isGenericContext(...)
Add test case for crash triggered in `swift::DeclContext::isGenericContext(...)`.

Current number of unresolved compiler crashers: 69 (5108 resolved)

Stack trace:

```
4  swift           0x00000000010e5f27 swift::DeclContext::isGenericContext() const + 23
5  swift           0x00000000010dcea9 swift::ClassDecl::checkObjCAncestry() const + 185
6  swift           0x0000000000ebc685 swift::TypeChecker::validateDecl(swift::ValueDecl*, bool) + 421
7  swift           0x000000000111c5cb swift::DeclContext::lookupQualified(swift::Type, swift::DeclName, swift::NLOptions, swift::LazyResolver*, llvm::SmallVectorImpl<swift::ValueDecl*>&) const + 2667
8  swift           0x000000000111acaf swift::UnqualifiedLookup::UnqualifiedLookup(swift::DeclName, swift::DeclContext*, swift::LazyResolver*, bool, swift::SourceLoc, bool, bool) + 2495
9  swift           0x0000000000efe1cb swift::TypeChecker::lookupUnqualified(swift::DeclContext*, swift::DeclName, swift::SourceLoc, swift::OptionSet<swift::NameLookupFlags, unsigned int>) + 187
12 swift           0x0000000000f2fd6e swift::TypeChecker::resolveIdentifierType(swift::DeclContext*, swift::IdentTypeRepr*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, bool, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 158
14 swift           0x0000000000f30cc4 swift::TypeChecker::resolveType(swift::TypeRepr*, swift::DeclContext*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 164
15 swift           0x0000000000f2fc60 swift::TypeChecker::validateType(swift::TypeLoc&, swift::DeclContext*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 192
16 swift           0x0000000000ebb05a swift::TypeChecker::checkInheritanceClause(swift::Decl*, swift::GenericTypeResolver*) + 5194
17 swift           0x0000000000ebc658 swift::TypeChecker::validateDecl(swift::ValueDecl*, bool) + 376
22 swift           0x0000000000ec1c86 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 150
25 swift           0x0000000000f2899a swift::TypeChecker::typeCheckFunctionBodyUntil(swift::FuncDecl*, swift::SourceLoc) + 346
26 swift           0x0000000000f287fe swift::TypeChecker::typeCheckAbstractFunctionBodyUntil(swift::AbstractFunctionDecl*, swift::SourceLoc) + 46
27 swift           0x0000000000f293c3 swift::TypeChecker::typeCheckAbstractFunctionBody(swift::AbstractFunctionDecl*) + 179
29 swift           0x0000000000ee3f41 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) + 1281
30 swift           0x0000000000c6f749 swift::CompilerInstance::performSema() + 3289
32 swift           0x00000000007d8f39 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2857
33 swift           0x00000000007a4f58 main + 2872
Stack dump:
0.	Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28367-swift-declcontext-isgenericcontext.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28367-swift-declcontext-isgenericcontext-30331b.o
1.	While type-checking getter for a at validation-test/compiler_crashers/28367-swift-declcontext-isgenericcontext.swift:9:6
2.	While type-checking 'A' at validation-test/compiler_crashers/28367-swift-declcontext-isgenericcontext.swift:9:9
3.	While resolving type d at [validation-test/compiler_crashers/28367-swift-declcontext-isgenericcontext.swift:9:28 - line:9:28] RangeText="d"
<unknown>:0: error: unable to execute command: Segmentation fault
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
```
2016-07-16 21:10:41 +02:00
practicalswift
7b8a834c30 [swiftc (68 vs. 5108)] Add crasher in swift::ArchetypeBuilder::finalize(...)
Add test case for crash triggered in `swift::ArchetypeBuilder::finalize(...)`.

Current number of unresolved compiler crashers: 68 (5108 resolved)

Assertion failure in [`lib/AST/ArchetypeBuilder.cpp (line 1686)`](https://github.com/apple/swift/blob/master/lib/AST/ArchetypeBuilder.cpp#L1686):

```
Assertion `dist > 0 && "nested type should have matched associated type"' failed.

When executing: swift::Identifier typoCorrectNestedType(ArchetypeBuilder::PotentialArchetype *)
```

Assertion context:

```
        continue;

      unsigned dist = name.edit_distance(assocType->getName().str(),
                                         /*allowReplacements=*/true,
                                         maxScore);
      assert(dist > 0 && "nested type should have matched associated type");
      if (bestEditDistance == 0 || dist == bestEditDistance) {
        bestEditDistance = dist;
        maxScore = bestEditDistance;
        bestMatches.push_back(assocType->getName());
      } else if (dist < bestEditDistance) {
```
Stack trace:

```
swift: /path/to/swift/lib/AST/ArchetypeBuilder.cpp:1686: swift::Identifier typoCorrectNestedType(ArchetypeBuilder::PotentialArchetype *): Assertion `dist > 0 && "nested type should have matched associated type"' failed.
8  swift           0x0000000000ff6e37 swift::ArchetypeBuilder::finalize(swift::SourceLoc) + 2231
9  swift           0x0000000000ef1ee7 swift::TypeChecker::validateGenericSignature(swift::GenericParamList*, swift::DeclContext*, swift::GenericSignature*, std::function<bool (swift::ArchetypeBuilder&)>, bool&) + 183
10 swift           0x0000000000ef2a1f swift::TypeChecker::validateGenericTypeSignature(swift::GenericTypeDecl*) + 111
11 swift           0x0000000000eb32fb swift::TypeChecker::validateDecl(swift::ValueDecl*, bool) + 363
16 swift           0x0000000000eb8936 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 150
17 swift           0x0000000000edaaf2 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) + 1026
18 swift           0x0000000000c66849 swift::CompilerInstance::performSema() + 3289
20 swift           0x00000000007d8bb9 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2857
21 swift           0x00000000007a4bd8 main + 2872
Stack dump:
0.	Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28366-swift-archetypebuilder-finalize.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28366-swift-archetypebuilder-finalize-f3dc29.o
1.	While type-checking 'A' at validation-test/compiler_crashers/28366-swift-archetypebuilder-finalize.swift:11:2
<unknown>:0: error: unable to execute command: Aborted
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
```
2016-07-14 17:21:16 +02:00
practicalswift
1a52f9cc75 [swiftc (67 vs. 5108)] Add crasher in swift::constraints::ConstraintGraphNode::getMemberType(…)
Add test case for crash triggered in `swift::constraints::ConstraintGraphNode::getMemberType(…)`.

Current number of unresolved compiler crashers: 67 (5108 resolved)

Stack trace:

```
6  swift           0x0000000000fe3696 swift::constraints::ConstraintGraphNode::getMemberType(swift::Identifier, std::function<swift::TypeVariableType* ()>) + 182
7  swift           0x0000000000fe425a swift::constraints::ConstraintGraph::getMemberType(swift::TypeVariableType*, swift::Identifier, std::function<swift::TypeVariableType* ()>) + 154
9  swift           0x000000000112b4e4 swift::Type::transform(llvm::function_ref<swift::Type (swift::Type)>) const + 36
10 swift           0x0000000000f438eb swift::constraints::ConstraintSystem::openGeneric(swift::DeclContext*, swift::DeclContext*, llvm::ArrayRef<swift::GenericTypeParamType*>, llvm::ArrayRef<swift::Requirement>, bool, swift::constraints::ConstraintLocatorBuilder, llvm::DenseMap<swift::CanType, swift::TypeVariableType*, llvm::DenseMapInfo<swift::CanType>, llvm::detail::DenseMapPair<swift::CanType, swift::TypeVariableType*> >&) + 1611
12 swift           0x000000000112b4e4 swift::Type::transform(llvm::function_ref<swift::Type (swift::Type)>) const + 36
13 swift           0x0000000000f41d9e swift::constraints::ConstraintSystem::openType(swift::Type, swift::constraints::ConstraintLocatorBuilder, llvm::DenseMap<swift::CanType, swift::TypeVariableType*, llvm::DenseMapInfo<swift::CanType>, llvm::detail::DenseMapPair<swift::CanType, swift::TypeVariableType*> >&) + 78
18 swift           0x000000000106e4be swift::Expr::walk(swift::ASTWalker&) + 46
19 swift           0x0000000000f8ba78 swift::constraints::ConstraintSystem::generateConstraints(swift::Expr*) + 200
20 swift           0x0000000000e9fb53 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>) + 371
21 swift           0x0000000000ea6492 swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*) + 610
22 swift           0x0000000000ea7647 swift::TypeChecker::typeCheckBinding(swift::Pattern*&, swift::Expr*&, swift::DeclContext*) + 343
23 swift           0x0000000000ea785b swift::TypeChecker::typeCheckPatternBinding(swift::PatternBindingDecl*, unsigned int) + 267
25 swift           0x0000000000eb363d swift::TypeChecker::validateDecl(swift::ValueDecl*, bool) + 3853
27 swift           0x0000000000eb7ed6 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 150
28 swift           0x0000000000eda092 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) + 1026
29 swift           0x0000000000c65ea9 swift::CompilerInstance::performSema() + 3289
31 swift           0x00000000007d8b49 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2857
32 swift           0x00000000007a4b68 main + 2872
Stack dump:
0.	Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28365-swift-constraints-constraintgraphnode-getmembertype.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28365-swift-constraints-constraintgraphnode-getmembertype-b3e759.o
1.	While type-checking 'd' at validation-test/compiler_crashers/28365-swift-constraints-constraintgraphnode-getmembertype.swift:9:12
2.	While type-checking expression at [validation-test/compiler_crashers/28365-swift-constraints-constraintgraphnode-getmembertype.swift:9:25 - line:9:27] RangeText="B{}"
<unknown>:0: error: unable to execute command: Segmentation fault
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
```
2016-07-13 10:01:13 +02:00
practicalswift
6898f60e20 Add 💥 (😢 → 66, 😀 → 5108) in swift::TypeChecker::addImplicitConstructors(…)
Add test case for crash triggered in `swift::TypeChecker::addImplicitConstructors(…)`.

Assertion failure in [`lib/Sema/TypeCheckDecl.cpp (line 7354)`](https://github.com/apple/swift/blob/master/lib/Sema/TypeCheckDecl.cpp#L7354):

```
Assertion `!classDecl->hasSuperclass() || classDecl->getSuperclass()->getAnyNominal()->isInvalid() || classDecl->getSuperclass()->getAnyNominal() ->addedImplicitInitializers()' failed.

When executing: void swift::TypeChecker::addImplicitConstructors(swift::NominalTypeDecl *)
```

<details>
<summary>Assertion context:</summary>
```
        && !structDecl->hasUnreferenceableStorage()) {
      // For a struct with memberwise initialized properties, we add a
      // memberwise init.
      if (FoundMemberwiseInitializedProperty) {
        // Create the implicit memberwise constructor.
        auto ctor = createImplicitConstructor(
                      *this, decl, ImplicitConstructorKind::Memberwise);
        decl->addMember(ctor);
      }

      // If we found a stored property, add a default constructor.
      if (!SuppressDefaultInitializer)
        defineDefaultConstructor(decl);
    }
    return;
  }

  // For a class with a superclass, automatically define overrides
  // for all of the superclass's designated initializers.
  // FIXME: Currently skipping generic classes.
  auto classDecl = cast<ClassDecl>(decl);
  assert(!classDecl->hasSuperclass() ||
         classDecl->getSuperclass()->getAnyNominal()->isInvalid() ||
         classDecl->getSuperclass()->getAnyNominal()
           ->addedImplicitInitializers());
  if (classDecl->hasSuperclass()) {
    bool canInheritInitializers = !FoundDesignatedInit;

    // We can't define these overrides if we have any uninitialized
    // stored properties.
```
</details>
<details>
<summary>Stack trace:</summary>
```
swift: /path/to/swift/lib/Sema/TypeCheckDecl.cpp:7354: void swift::TypeChecker::addImplicitConstructors(swift::NominalTypeDecl *): Assertion `!classDecl->hasSuperclass() || classDecl->getSuperclass()->getAnyNominal()->isInvalid() || classDecl->getSuperclass()->getAnyNominal() ->addedImplicitInitializers()' failed.
8  swift           0x0000000000ebd54a swift::TypeChecker::addImplicitConstructors(swift::NominalTypeDecl*) + 4506
9  swift           0x0000000000eb044e swift::TypeChecker::checkInheritanceClause(swift::Decl*, swift::GenericTypeResolver*) + 5854
10 swift           0x0000000000eb1778 swift::TypeChecker::validateDecl(swift::ValueDecl*, bool) + 376
11 swift           0x0000000001110bdb swift::DeclContext::lookupQualified(swift::Type, swift::DeclName, swift::NLOptions, swift::LazyResolver*, llvm::SmallVectorImpl<swift::ValueDecl*>&) const + 2667
12 swift           0x000000000110f2bf swift::UnqualifiedLookup::UnqualifiedLookup(swift::DeclName, swift::DeclContext*, swift::LazyResolver*, bool, swift::SourceLoc, bool, bool) + 2495
13 swift           0x0000000000ef32db swift::TypeChecker::lookupUnqualified(swift::DeclContext*, swift::DeclName, swift::SourceLoc, swift::OptionSet<swift::NameLookupFlags, unsigned int>) + 187
16 swift           0x0000000000f24b8e swift::TypeChecker::resolveIdentifierType(swift::DeclContext*, swift::IdentTypeRepr*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, bool, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 158
18 swift           0x0000000000f25ae4 swift::TypeChecker::resolveType(swift::TypeRepr*, swift::DeclContext*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 164
19 swift           0x0000000000f24a80 swift::TypeChecker::validateType(swift::TypeLoc&, swift::DeclContext*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 192
20 swift           0x0000000000eb017a swift::TypeChecker::checkInheritanceClause(swift::Decl*, swift::GenericTypeResolver*) + 5130
21 swift           0x0000000000eb1778 swift::TypeChecker::validateDecl(swift::ValueDecl*, bool) + 376
22 swift           0x0000000001110bdb swift::DeclContext::lookupQualified(swift::Type, swift::DeclName, swift::NLOptions, swift::LazyResolver*, llvm::SmallVectorImpl<swift::ValueDecl*>&) const + 2667
23 swift           0x000000000110f2bf swift::UnqualifiedLookup::UnqualifiedLookup(swift::DeclName, swift::DeclContext*, swift::LazyResolver*, bool, swift::SourceLoc, bool, bool) + 2495
24 swift           0x0000000000ef32db swift::TypeChecker::lookupUnqualified(swift::DeclContext*, swift::DeclName, swift::SourceLoc, swift::OptionSet<swift::NameLookupFlags, unsigned int>) + 187
27 swift           0x0000000000f24b8e swift::TypeChecker::resolveIdentifierType(swift::DeclContext*, swift::IdentTypeRepr*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, bool, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 158
29 swift           0x0000000000f25ae4 swift::TypeChecker::resolveType(swift::TypeRepr*, swift::DeclContext*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 164
30 swift           0x0000000000f24a80 swift::TypeChecker::validateType(swift::TypeLoc&, swift::DeclContext*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 192
32 swift           0x0000000000eef09e swift::TypeChecker::validateGenericFuncSignature(swift::AbstractFunctionDecl*) + 94
37 swift           0x0000000000eb6da6 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 150
40 swift           0x0000000000f1eb64 swift::TypeChecker::typeCheckClosureBody(swift::ClosureExpr*) + 244
41 swift           0x0000000000f4aeac swift::constraints::ConstraintSystem::applySolution(swift::constraints::Solution&, swift::Expr*, swift::Type, bool, bool, bool) + 876
42 swift           0x0000000000ea5431 swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*) + 769
44 swift           0x0000000000f1eca6 swift::TypeChecker::typeCheckTopLevelCodeDecl(swift::TopLevelCodeDecl*) + 134
45 swift           0x0000000000ed8fcd swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) + 1133
46 swift           0x0000000000c65a49 swift::CompilerInstance::performSema() + 3289
48 swift           0x00000000007d89b9 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2857
49 swift           0x00000000007a49d8 main + 2872
Stack dump:
0.	Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28364-swift-typechecker-addimplicitconstructors.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28364-swift-typechecker-addimplicitconstructors-2a3ab6.o
1.	While type-checking expression at [validation-test/compiler_crashers/28364-swift-typechecker-addimplicitconstructors.swift:10:1 - line:15:12] RangeText="{
2.	While type-checking 'd' at validation-test/compiler_crashers/28364-swift-typechecker-addimplicitconstructors.swift:11:1
3.	While resolving type B<T> at [validation-test/compiler_crashers/28364-swift-typechecker-addimplicitconstructors.swift:12:8 - line:12:11] RangeText="B<T>"
4.	While resolving type b at [validation-test/compiler_crashers/28364-swift-typechecker-addimplicitconstructors.swift:15:12 - line:15:12] RangeText="b"
<unknown>:0: error: unable to execute command: Aborted
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
```
</details>
2016-07-12 21:15:06 +02:00
practicalswift
1aacf06971 Add 💥 (😢 → 65, 😀 → 5108) in swift::Expr::walk(…)
Add test case for crash triggered in `swift::Expr::walk(…)`.

Assertion failure in `llvm/include/llvm/Support/Casting.h (line 237)`:

```
Assertion `isa<X>(Val) && "cast<Ty>() argument of incompatible type!"' failed.

When executing: typename cast_retty<X, Y *>::ret_type llvm::cast(Y *) [X = swift::EnumType, Y = swift::TypeBase]
```

<details>
<summary>Assertion context:</summary>
```
//
template <class X, class Y>
inline typename std::enable_if<!is_simple_type<Y>::value,
                               typename cast_retty<X, const Y>::ret_type>::type
cast(const Y &Val) {
  assert(isa<X>(Val) && "cast<Ty>() argument of incompatible type!");
  return cast_convert_val<
      X, const Y, typename simplify_type<const Y>::SimpleType>::doit(Val);
}

template <class X, class Y>
inline typename cast_retty<X, Y>::ret_type cast(Y &Val) {
  assert(isa<X>(Val) && "cast<Ty>() argument of incompatible type!");
  return cast_convert_val<X, Y,
                          typename simplify_type<Y>::SimpleType>::doit(Val);
}

template <class X, class Y>
inline typename cast_retty<X, Y *>::ret_type cast(Y *Val) {
  assert(isa<X>(Val) && "cast<Ty>() argument of incompatible type!");
  return cast_convert_val<X, Y*,
                          typename simplify_type<Y*>::SimpleType>::doit(Val);
}

// cast_or_null<X> - Functionally identical to cast, except that a null value is
// accepted.
//
template <class X, class Y>
LLVM_ATTRIBUTE_UNUSED_RESULT inline typename std::enable_if<
    !is_simple_type<Y>::value, typename cast_retty<X, const Y>::ret_type>::type
```
</details>
<details>
<summary>Stack trace:</summary>
```
swift: /path/to/llvm/include/llvm/Support/Casting.h:237: typename cast_retty<X, Y *>::ret_type llvm::cast(Y *) [X = swift::EnumType, Y = swift::TypeBase]: Assertion `isa<X>(Val) && "cast<Ty>() argument of incompatible type!"' failed.
11 swift           0x000000000106cca5 swift::Expr::walk(swift::ASTWalker&) + 69
12 swift           0x0000000000f4ad42 swift::constraints::ConstraintSystem::applySolution(swift::constraints::Solution&, swift::Expr*, swift::Type, bool, bool, bool) + 514
13 swift           0x0000000000ea5431 swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*) + 769
14 swift           0x0000000000ea6547 swift::TypeChecker::typeCheckBinding(swift::Pattern*&, swift::Expr*&, swift::DeclContext*) + 343
15 swift           0x0000000000ea675b swift::TypeChecker::typeCheckPatternBinding(swift::PatternBindingDecl*, unsigned int) + 267
17 swift           0x0000000000eb250d swift::TypeChecker::validateDecl(swift::ValueDecl*, bool) + 3853
21 swift           0x0000000000eb6da6 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 150
22 swift           0x0000000000ed8f62 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) + 1026
23 swift           0x0000000000c65a49 swift::CompilerInstance::performSema() + 3289
25 swift           0x00000000007d89b9 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2857
26 swift           0x00000000007a49d8 main + 2872
Stack dump:
0.	Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28363-swift-expr-walk.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28363-swift-expr-walk-b823a6.o
1.	While type-checking 'A' at validation-test/compiler_crashers/28363-swift-expr-walk.swift:11:1
2.	While type-checking expression at [validation-test/compiler_crashers/28363-swift-expr-walk.swift:14:7 - line:14:7] RangeText="c"
<unknown>:0: error: unable to execute command: Aborted
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
```
</details>
2016-07-12 21:10:38 +02:00
practicalswift
0c1f140500 Add 💥 (😢 → 64, 😀 → 5107) in swift::constraints::ConstraintGraphNode::getAdjacency(…)
Add test case for crash triggered in `swift::constraints::ConstraintGraphNode::getAdjacency(…)`.

Assertion failure in [`lib/Sema/ConstraintGraph.cpp (line 129)`](https://github.com/apple/swift/blob/master/lib/Sema/ConstraintGraph.cpp#L129):

```
Assertion `typeVar != TypeVar && "Cannot be adjacent to oneself"' failed.

When executing: ConstraintGraphNode::Adjacency &swift::constraints::ConstraintGraphNode::getAdjacency(swift::TypeVariableType *)
```

<details>
<summary>Assertion context:</summary>
```

  // If this is the last constraint, just pop it off the list and we're done.
  unsigned lastIndex = Constraints.size()-1;
  if (index == lastIndex) {
    Constraints.pop_back();
    return;
  }

  // This constraint is somewhere in the middle; swap it with the last
  // constraint, so we can remove the constraint from the vector in O(1)
  // time rather than O(n) time.
  auto lastConstraint = Constraints[lastIndex];
  Constraints[index] = lastConstraint;
  ConstraintIndex[lastConstraint] = index;
  Constraints.pop_back();
}

ConstraintGraphNode::Adjacency &
ConstraintGraphNode::getAdjacency(TypeVariableType *typeVar) {
  assert(typeVar != TypeVar && "Cannot be adjacent to oneself");

  // Look for existing adjacency information.
  auto pos = AdjacencyInfo.find(typeVar);

  if (pos != AdjacencyInfo.end())
    return pos->second;

  // If we weren't already adjacent to this type variable, add it to the
  // list of adjacencies.
  pos = AdjacencyInfo.insert(
```
</details>
<details>
<summary>Stack trace:</summary>
```
swift: /path/to/swift/lib/Sema/ConstraintGraph.cpp:129: ConstraintGraphNode::Adjacency &swift::constraints::ConstraintGraphNode::getAdjacency(swift::TypeVariableType *): Assertion `typeVar != TypeVar && "Cannot be adjacent to oneself"' failed.
8  swift           0x0000000000fe1be8 swift::constraints::ConstraintGraphNode::getAdjacency(swift::TypeVariableType*) + 296
9  swift           0x0000000000fe15e2 swift::constraints::ConstraintGraph::bindTypeVariable(swift::TypeVariableType*, swift::Type) + 242
10 swift           0x0000000000f3f4de swift::constraints::ConstraintSystem::assignFixedType(swift::TypeVariableType*, swift::Type, bool) + 366
11 swift           0x0000000000fa2fdc swift::constraints::ConstraintSystem::matchTypes(swift::Type, swift::Type, swift::constraints::TypeMatchKind, unsigned int, swift::constraints::ConstraintLocatorBuilder) + 3404
12 swift           0x0000000000fa702d swift::constraints::ConstraintSystem::matchDeepEqualityTypes(swift::Type, swift::Type, swift::constraints::ConstraintLocatorBuilder) + 877
13 swift           0x0000000000fa7a43 swift::constraints::ConstraintSystem::simplifyRestrictedConstraint(swift::constraints::ConversionRestrictionKind, swift::Type, swift::Type, swift::constraints::TypeMatchKind, unsigned int, swift::constraints::ConstraintLocatorBuilder) + 1091
14 swift           0x0000000000fa4c92 swift::constraints::ConstraintSystem::matchTypes(swift::Type, swift::Type, swift::constraints::TypeMatchKind, unsigned int, swift::constraints::ConstraintLocatorBuilder) + 10754
15 swift           0x0000000000fa6b40 swift::constraints::ConstraintSystem::matchFunctionTypes(swift::FunctionType*, swift::FunctionType*, swift::constraints::TypeMatchKind, unsigned int, swift::constraints::ConstraintLocatorBuilder) + 672
16 swift           0x0000000000fa5d81 swift::constraints::ConstraintSystem::matchTypes(swift::Type, swift::Type, swift::constraints::TypeMatchKind, unsigned int, swift::constraints::ConstraintLocatorBuilder) + 15089
17 swift           0x0000000000fae6f2 swift::constraints::ConstraintSystem::simplifyConstraint(swift::constraints::Constraint const&) + 626
18 swift           0x0000000000fb1a79 swift::constraints::ConstraintSystem::simplify(bool) + 105
19 swift           0x0000000000fb4e80 swift::constraints::ConstraintSystem::solveRec(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::FreeTypeVariableBinding) + 48
20 swift           0x0000000000fb8c83 swift::constraints::ConstraintSystem::solveSimplified(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::FreeTypeVariableBinding) + 9171
21 swift           0x0000000000fb4f95 swift::constraints::ConstraintSystem::solveRec(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::FreeTypeVariableBinding) + 325
22 swift           0x0000000000fb8c83 swift::constraints::ConstraintSystem::solveSimplified(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::FreeTypeVariableBinding) + 9171
23 swift           0x0000000000fb4f95 swift::constraints::ConstraintSystem::solveRec(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::FreeTypeVariableBinding) + 325
24 swift           0x0000000000fb7600 swift::constraints::ConstraintSystem::solveSimplified(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::FreeTypeVariableBinding) + 3408
25 swift           0x0000000000fb4f95 swift::constraints::ConstraintSystem::solveRec(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::FreeTypeVariableBinding) + 325
26 swift           0x0000000000fb8c83 swift::constraints::ConstraintSystem::solveSimplified(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::FreeTypeVariableBinding) + 9171
27 swift           0x0000000000fb4f95 swift::constraints::ConstraintSystem::solveRec(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::FreeTypeVariableBinding) + 325
28 swift           0x0000000000fb8c83 swift::constraints::ConstraintSystem::solveSimplified(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::FreeTypeVariableBinding) + 9171
29 swift           0x0000000000fb4f95 swift::constraints::ConstraintSystem::solveRec(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::FreeTypeVariableBinding) + 325
30 swift           0x0000000000fb7600 swift::constraints::ConstraintSystem::solveSimplified(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::FreeTypeVariableBinding) + 3408
31 swift           0x0000000000fb4f95 swift::constraints::ConstraintSystem::solveRec(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::FreeTypeVariableBinding) + 325
32 swift           0x0000000000fb8c83 swift::constraints::ConstraintSystem::solveSimplified(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::FreeTypeVariableBinding) + 9171
33 swift           0x0000000000fb4f95 swift::constraints::ConstraintSystem::solveRec(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::FreeTypeVariableBinding) + 325
34 swift           0x0000000000fb8c83 swift::constraints::ConstraintSystem::solveSimplified(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::FreeTypeVariableBinding) + 9171
35 swift           0x0000000000fb4f95 swift::constraints::ConstraintSystem::solveRec(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::FreeTypeVariableBinding) + 325
36 swift           0x0000000000fb8c83 swift::constraints::ConstraintSystem::solveSimplified(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::FreeTypeVariableBinding) + 9171
37 swift           0x0000000000fb4f95 swift::constraints::ConstraintSystem::solveRec(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::FreeTypeVariableBinding) + 325
38 swift           0x0000000000fb8c83 swift::constraints::ConstraintSystem::solveSimplified(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::FreeTypeVariableBinding) + 9171
39 swift           0x0000000000fb4f95 swift::constraints::ConstraintSystem::solveRec(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::FreeTypeVariableBinding) + 325
40 swift           0x0000000000fb4d49 swift::constraints::ConstraintSystem::solve(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::FreeTypeVariableBinding) + 73
41 swift           0x0000000000e9ec00 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>) + 800
42 swift           0x0000000000ea5392 swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*) + 610
44 swift           0x0000000000f1eca6 swift::TypeChecker::typeCheckTopLevelCodeDecl(swift::TopLevelCodeDecl*) + 134
45 swift           0x0000000000ed8fcd swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) + 1133
46 swift           0x0000000000c65a49 swift::CompilerInstance::performSema() + 3289
48 swift           0x00000000007d89b9 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2857
49 swift           0x00000000007a49d8 main + 2872
Stack dump:
0.	Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28362-swift-constraints-constraintgraphnode-getadjacency.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28362-swift-constraints-constraintgraphnode-getadjacency-2beaa7.o
1.	While type-checking expression at [validation-test/compiler_crashers/28362-swift-constraints-constraintgraphnode-getadjacency.swift:10:1 - line:10:10] RangeText="[1,{[1,{[]"
<unknown>:0: error: unable to execute command: Aborted
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
```
</details>
2016-07-12 07:56:55 +02:00
practicalswift
76844eebef Add 💥 (😢 → 63, 😀 → 5107) in swift::ArchetypeBuilder::mapTypeIntoContext(…)
Add test case for crash triggered in `swift::ArchetypeBuilder::mapTypeIntoContext(…)`.

Assertion failure in [`lib/AST/ArchetypeBuilder.cpp (line 2037)`](https://github.com/apple/swift/blob/master/lib/AST/ArchetypeBuilder.cpp#L2037):

```
Assertion `genericParams && "dependent type in non-generic context"' failed.

When executing: static swift::Type swift::ArchetypeBuilder::mapTypeIntoContext(Module *, swift::GenericParamList *, swift::Type, swift::LazyResolver *)
```

<details>
<summary>Assertion context:</summary>
```
  out << "\n";
}

Type ArchetypeBuilder::mapTypeIntoContext(const DeclContext *dc, Type type,
                                          LazyResolver *resolver) {
  auto genericParams = dc->getGenericParamsOfContext();
  return mapTypeIntoContext(dc->getParentModule(), genericParams, type,
                            resolver);
}

Type ArchetypeBuilder::mapTypeIntoContext(Module *M,
                                          GenericParamList *genericParams,
                                          Type type,
                                          LazyResolver *resolver) {
  auto canType = type->getCanonicalType();
  assert(!canType->hasArchetype() && "already have a contextual type");
  if (!canType->hasTypeParameter())
    return type;

  assert(genericParams && "dependent type in non-generic context");

  unsigned genericParamsDepth = genericParams->getDepth();
  type = type.transform([&](Type type) -> Type {
    // Map a generic parameter type to its archetype.
    if (auto gpType = type->getAs<GenericTypeParamType>()) {
      auto index = gpType->getIndex();
      unsigned depth = gpType->getDepth();

      // Skip down to the generic parameter list that houses the corresponding
      // generic parameter.
```
</details>
<details>
<summary>Stack trace:</summary>
```
swift: /path/to/swift/lib/AST/ArchetypeBuilder.cpp:2037: static swift::Type swift::ArchetypeBuilder::mapTypeIntoContext(Module *, swift::GenericParamList *, swift::Type, swift::LazyResolver *): Assertion `genericParams && "dependent type in non-generic context"' failed.
8  swift           0x0000000000ff2e93 swift::ArchetypeBuilder::mapTypeIntoContext(swift::ModuleDecl*, swift::GenericParamList*, swift::Type, swift::LazyResolver*) + 243
12 swift           0x0000000000eb3b36 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 150
15 swift           0x0000000000f1b9e4 swift::TypeChecker::typeCheckClosureBody(swift::ClosureExpr*) + 244
16 swift           0x0000000000f47d2c swift::constraints::ConstraintSystem::applySolution(swift::constraints::Solution&, swift::Expr*, swift::Type, bool, bool, bool) + 876
17 swift           0x0000000000ea21c1 swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*) + 769
18 swift           0x0000000000ea32d7 swift::TypeChecker::typeCheckBinding(swift::Pattern*&, swift::Expr*&, swift::DeclContext*) + 343
19 swift           0x0000000000ea34eb swift::TypeChecker::typeCheckPatternBinding(swift::PatternBindingDecl*, unsigned int) + 267
24 swift           0x0000000000eb3b36 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 150
25 swift           0x0000000000ed5cf2 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) + 1026
26 swift           0x0000000000c62529 swift::CompilerInstance::performSema() + 3289
28 swift           0x00000000007d8649 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2857
29 swift           0x00000000007a4668 main + 2872
Stack dump:
0.	Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28361-swift-archetypebuilder-maptypeintocontext.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28361-swift-archetypebuilder-maptypeintocontext-8b9576.o
1.	While type-checking 'a' at validation-test/compiler_crashers/28361-swift-archetypebuilder-maptypeintocontext.swift:11:1
2.	While type-checking expression at [validation-test/compiler_crashers/28361-swift-archetypebuilder-maptypeintocontext.swift:11:15 - line:13:11] RangeText="{associatedtype e
3.	While type-checking 'S' at validation-test/compiler_crashers/28361-swift-archetypebuilder-maptypeintocontext.swift:13:1
<unknown>:0: error: unable to execute command: Aborted
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
```
</details>
2016-07-12 01:55:27 +02:00
practicalswift
97f0b5c7c6 Add 💥 (😢 → 62, 😀 → 5107) in swift::ArchetypeBuilder::mapTypeOutOfContext(…)
Add test case for crash triggered in `swift::ArchetypeBuilder::mapTypeOutOfContext(…)`.

Assertion failure in [`lib/AST/ArchetypeBuilder.cpp (line 2096)`](https://github.com/apple/swift/blob/master/lib/AST/ArchetypeBuilder.cpp#L2096):

```
Assertion `genericParams && "dependent type in non-generic context"' failed.

When executing: static swift::Type swift::ArchetypeBuilder::mapTypeOutOfContext(swift::ModuleDecl *, swift::GenericParamList *, swift::Type)
```

<details>
<summary>Assertion context:</summary>
```

  assert(!type->hasTypeParameter() && "not fully substituted");
  return type;
}

Type
ArchetypeBuilder::mapTypeOutOfContext(const DeclContext *dc, Type type) {
  GenericParamList *genericParams = dc->getGenericParamsOfContext();
  return mapTypeOutOfContext(dc->getParentModule(), genericParams, type);
}

Type ArchetypeBuilder::mapTypeOutOfContext(ModuleDecl *M,
                                           GenericParamList *genericParams,
                                           Type type) {
  auto canType = type->getCanonicalType();
  assert(!canType->hasTypeParameter() && "already have an interface type");
  if (!canType->hasArchetype())
    return type;

  assert(genericParams && "dependent type in non-generic context");

  // Capture the archetype -> interface type mapping.
  TypeSubstitutionMap subs;
  for (auto params = genericParams; params != nullptr;
       params = params->getOuterParameters()) {
    for (auto param : *params) {
      subs[param->getArchetype()] = param->getDeclaredType();
    }
  }

```
</details>
<details>
<summary>Stack trace:</summary>
```
swift: /path/to/swift/lib/AST/ArchetypeBuilder.cpp:2096: static swift::Type swift::ArchetypeBuilder::mapTypeOutOfContext(swift::ModuleDecl *, swift::GenericParamList *, swift::Type): Assertion `genericParams && "dependent type in non-generic context"' failed.
8  swift           0x0000000000ff26b4 swift::ArchetypeBuilder::mapTypeOutOfContext(swift::ModuleDecl*, swift::GenericParamList*, swift::Type) + 324
11 swift           0x0000000000efd15e swift::TypeChecker::resolveTypeWitness(swift::NormalProtocolConformance const*, swift::AssociatedTypeDecl*) + 254
12 swift           0x0000000001116c16 swift::NormalProtocolConformance::getTypeWitnessSubstAndDecl(swift::AssociatedTypeDecl*, swift::LazyResolver*) const + 150
13 swift           0x0000000001116b58 swift::ProtocolConformance::getTypeWitnessSubstAndDecl(swift::AssociatedTypeDecl*, swift::LazyResolver*) const + 40
14 swift           0x0000000001117326 swift::ProtocolConformance::getTypeWitness(swift::AssociatedTypeDecl*, swift::LazyResolver*) const + 6
17 swift           0x0000000001125fc4 swift::Type::transform(llvm::function_ref<swift::Type (swift::Type)>) const + 36
18 swift           0x000000000111f4d4 swift::Type::subst(swift::ModuleDecl*, llvm::DenseMap<swift::TypeBase*, swift::Type, llvm::DenseMapInfo<swift::TypeBase*>, llvm::detail::DenseMapPair<swift::TypeBase*, swift::Type> >&, swift::OptionSet<swift::SubstFlags, unsigned int>) const + 68
19 swift           0x0000000000f448cf swift::constraints::Solution::computeSubstitutions(swift::Type, swift::DeclContext*, swift::Type, swift::constraints::ConstraintLocator*, llvm::SmallVectorImpl<swift::Substitution>&) const + 943
24 swift           0x0000000001069455 swift::Expr::walk(swift::ASTWalker&) + 69
25 swift           0x0000000000f474f2 swift::constraints::ConstraintSystem::applySolution(swift::constraints::Solution&, swift::Expr*, swift::Type, bool, bool, bool) + 514
26 swift           0x0000000000ea2121 swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*) + 769
28 swift           0x0000000000f63f3f swift::constraints::ConstraintSystem::diagnoseFailureForExpr(swift::Expr*) + 207
29 swift           0x0000000000f6985e swift::constraints::ConstraintSystem::salvage(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::Expr*) + 3998
30 swift           0x0000000000e9b922 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>) + 850
31 swift           0x0000000000ea2082 swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*) + 610
34 swift           0x0000000000f63ed9 swift::constraints::ConstraintSystem::diagnoseFailureForExpr(swift::Expr*) + 105
35 swift           0x0000000000f6985e swift::constraints::ConstraintSystem::salvage(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::Expr*) + 3998
36 swift           0x0000000000e9b922 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>) + 850
37 swift           0x0000000000ea2082 swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*) + 610
38 swift           0x0000000000ea3237 swift::TypeChecker::typeCheckBinding(swift::Pattern*&, swift::Expr*&, swift::DeclContext*) + 343
39 swift           0x0000000000ea344b swift::TypeChecker::typeCheckPatternBinding(swift::PatternBindingDecl*, unsigned int) + 267
46 swift           0x0000000000eb3a96 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 150
47 swift           0x0000000000ed5c22 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) + 1026
48 swift           0x0000000000c624c9 swift::CompilerInstance::performSema() + 3289
50 swift           0x00000000007d85e9 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2857
51 swift           0x00000000007a4608 main + 2872
Stack dump:
0.	Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28360-swift-archetypebuilder-maptypeoutofcontext.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28360-swift-archetypebuilder-maptypeoutofcontext-089464.o
1.	While type-checking 'A' at validation-test/compiler_crashers/28360-swift-archetypebuilder-maptypeoutofcontext.swift:10:1
2.	While type-checking expression at [validation-test/compiler_crashers/28360-swift-archetypebuilder-maptypeoutofcontext.swift:10:52 - line:10:59] RangeText="A.a as a"
3.	While type-checking expression at [validation-test/compiler_crashers/28360-swift-archetypebuilder-maptypeoutofcontext.swift:10:52 - line:10:54] RangeText="A.a"
4.	While type-checking expression at [validation-test/compiler_crashers/28360-swift-archetypebuilder-maptypeoutofcontext.swift:10:52 - line:10:54] RangeText="A.a"
<unknown>:0: error: unable to execute command: Aborted
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
```
</details>
2016-07-10 22:35:50 +02:00
practicalswift
73a715d958 Add 💥 (😢 → 61, 😀 → 5107) in swift::constraints::ConstraintSystem::addTypeVariableConstraintsToWorkList(…)
Add test case for crash triggered in `swift::constraints::ConstraintSystem::addTypeVariableConstraintsToWorkList(…)`.

<details>
<summary>Stack trace:</summary>
```
4  swift           0x0000000000f3b8e1 swift::constraints::ConstraintSystem::addTypeVariableConstraintsToWorkList(swift::TypeVariableType*) + 113
5  swift           0x0000000000f3bae9 swift::constraints::ConstraintSystem::assignFixedType(swift::TypeVariableType*, swift::Type, bool) + 377
6  swift           0x0000000000fabea8 swift::constraints::ConstraintSystem::finalize(swift::FreeTypeVariableBinding) + 792
7  swift           0x0000000000fb5933 swift::constraints::ConstraintSystem::solveSimplified(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::FreeTypeVariableBinding) + 11843
8  swift           0x0000000000fb11d5 swift::constraints::ConstraintSystem::solveRec(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::FreeTypeVariableBinding) + 325
9  swift           0x0000000000fb4ec3 swift::constraints::ConstraintSystem::solveSimplified(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::FreeTypeVariableBinding) + 9171
10 swift           0x0000000000fb11d5 swift::constraints::ConstraintSystem::solveRec(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::FreeTypeVariableBinding) + 325
11 swift           0x0000000000fb4ec3 swift::constraints::ConstraintSystem::solveSimplified(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::FreeTypeVariableBinding) + 9171
12 swift           0x0000000000fb1d29 swift::constraints::ConstraintSystem::solveRec(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::FreeTypeVariableBinding) + 3225
13 swift           0x0000000000fb3840 swift::constraints::ConstraintSystem::solveSimplified(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::FreeTypeVariableBinding) + 3408
14 swift           0x0000000000fb11d5 swift::constraints::ConstraintSystem::solveRec(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::FreeTypeVariableBinding) + 325
15 swift           0x0000000000fb0f89 swift::constraints::ConstraintSystem::solve(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::FreeTypeVariableBinding) + 73
16 swift           0x0000000000e9b6d0 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>) + 800
17 swift           0x0000000000ea1e62 swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*) + 610
20 swift           0x0000000000f63cb9 swift::constraints::ConstraintSystem::diagnoseFailureForExpr(swift::Expr*) + 105
21 swift           0x0000000000f6963e swift::constraints::ConstraintSystem::salvage(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::Expr*) + 3998
22 swift           0x0000000000e9b702 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>) + 850
23 swift           0x0000000000ea1e62 swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*) + 610
26 swift           0x0000000000f19dea swift::TypeChecker::typeCheckFunctionBodyUntil(swift::FuncDecl*, swift::SourceLoc) + 346
27 swift           0x0000000000f19c4e swift::TypeChecker::typeCheckAbstractFunctionBodyUntil(swift::AbstractFunctionDecl*, swift::SourceLoc) + 46
28 swift           0x0000000000f1a813 swift::TypeChecker::typeCheckAbstractFunctionBody(swift::AbstractFunctionDecl*) + 179
30 swift           0x0000000000ed5b01 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) + 1281
31 swift           0x0000000000c62229 swift::CompilerInstance::performSema() + 3289
33 swift           0x00000000007d85a9 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2857
34 swift           0x00000000007a45c8 main + 2872
Stack dump:
0.	Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28359-swift-constraints-constraintsystem-addtypevariableconstraintstoworklist.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28359-swift-constraints-constraintsystem-addtypevariableconstraintstoworklist-e0b297.o
1.	While type-checking 'b' at validation-test/compiler_crashers/28359-swift-constraints-constraintsystem-addtypevariableconstraintstoworklist.swift:9:28
2.	While type-checking expression at [validation-test/compiler_crashers/28359-swift-constraints-constraintsystem-addtypevariableconstraintstoworklist.swift:9:35 - line:9:40] RangeText="{{a(a{"
3.	While type-checking expression at [validation-test/compiler_crashers/28359-swift-constraints-constraintsystem-addtypevariableconstraintstoworklist.swift:9:36 - line:9:40] RangeText="{a(a{"
<unknown>:0: error: unable to execute command: Segmentation fault
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
```
</details>
2016-07-09 23:27:56 +02:00
practicalswift
9b27a531da Add 💥 (😢 → 60, 😀 → 5107) in swift::TypeChecker::validateDecl(…)
Add test case for crash triggered in `swift::TypeChecker::validateDecl(…)`.

Assertion failure in [`lib/AST/ArchetypeBuilder.cpp (line 2109)`](https://github.com/apple/swift/blob/master/lib/AST/ArchetypeBuilder.cpp#L2109):

```
Assertion `!type->hasArchetype() && "not fully substituted"' failed.

When executing: static swift::Type swift::ArchetypeBuilder::mapTypeOutOfContext(swift::ModuleDecl *, swift::GenericParamList *, swift::Type)
```

<details>
<summary>Assertion context:</summary>
```
                                           Type type) {
  auto canType = type->getCanonicalType();
  assert(!canType->hasTypeParameter() && "already have an interface type");
  if (!canType->hasArchetype())
    return type;

  assert(genericParams && "dependent type in non-generic context");

  // Capture the archetype -> interface type mapping.
  TypeSubstitutionMap subs;
  for (auto params = genericParams; params != nullptr;
       params = params->getOuterParameters()) {
    for (auto param : *params) {
      subs[param->getArchetype()] = param->getDeclaredType();
    }
  }

  type = type.subst(M, subs, SubstFlags::AllowLoweredTypes);

  assert(!type->hasArchetype() && "not fully substituted");
  return type;
}

bool ArchetypeBuilder::addGenericSignature(GenericSignature *sig,
                                           bool adoptArchetypes,
                                           bool treatRequirementsAsExplicit) {
  if (!sig) return false;

  RequirementSource::Kind sourceKind = treatRequirementsAsExplicit
    ? RequirementSource::Explicit
```
</details>
<details>
<summary>Stack trace:</summary>
```
swift: /path/to/swift/lib/AST/ArchetypeBuilder.cpp:2109: static swift::Type swift::ArchetypeBuilder::mapTypeOutOfContext(swift::ModuleDecl *, swift::GenericParamList *, swift::Type): Assertion `!type->hasArchetype() && "not fully substituted"' failed.
11 swift           0x0000000000eaefdd swift::TypeChecker::validateDecl(swift::ValueDecl*, bool) + 3853
12 swift           0x0000000000f3377d swift::createImplicitConstructor(swift::TypeChecker&, swift::NominalTypeDecl*, swift::ImplicitConstructorKind) + 413
13 swift           0x0000000000eb9480 swift::TypeChecker::addImplicitConstructors(swift::NominalTypeDecl*) + 1536
16 swift           0x0000000000eb3876 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 150
19 swift           0x0000000000f1b164 swift::TypeChecker::typeCheckClosureBody(swift::ClosureExpr*) + 244
20 swift           0x0000000000f4743c swift::constraints::ConstraintSystem::applySolution(swift::constraints::Solution&, swift::Expr*, swift::Type, bool, bool, bool) + 876
21 swift           0x0000000000ea1f01 swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*) + 769
23 swift           0x0000000000f1b2a6 swift::TypeChecker::typeCheckTopLevelCodeDecl(swift::TopLevelCodeDecl*) + 134
24 swift           0x0000000000ed5a6d swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) + 1133
25 swift           0x0000000000c62229 swift::CompilerInstance::performSema() + 3289
27 swift           0x00000000007d85a9 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2857
28 swift           0x00000000007a45c8 main + 2872
Stack dump:
0.	Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28358-swift-typechecker-validatedecl.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28358-swift-typechecker-validatedecl-0ed663.o
1.	While type-checking expression at [validation-test/compiler_crashers/28358-swift-typechecker-validatedecl.swift:10:1 - line:10:36] RangeText="{struct B<h{typealias B<T>:T>var d=B"
2.	While type-checking 'B' at validation-test/compiler_crashers/28358-swift-typechecker-validatedecl.swift:10:2
<unknown>:0: error: unable to execute command: Aborted
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
```
</details>
2016-07-09 16:36:09 +02:00
practicalswift
d0ed7d3e80 Add 💥 (😢 → 59, 😀 → 5107) in swift::IterativeTypeChecker::processTypeCheckSuperclass(…)
Add test case for crash triggered in `swift::IterativeTypeChecker::processTypeCheckSuperclass(…)`.

Assertion failure in [`lib/AST/Decl.cpp (line 4765)`](https://github.com/apple/swift/blob/master/lib/AST/Decl.cpp#L4765):

```
Assertion `(!superclass || !superclass->hasArchetype()) && "superclass must be interface type"' failed.

When executing: void swift::ClassDecl::setSuperclass(swift::Type)
```

<details>
<summary>Assertion context:</summary>
```
  // Make sure the clang node has swift_newtype attribute
  if (!structDecl->getClangNode())
    return {};
  auto clangNode = structDecl->getClangNode();
  if (!clangNode.getAsDecl() ||
      !clangNode.castAsDecl()->getAttr<clang::SwiftNewtypeAttr>())
    return {};

  // Underlying type is the type of rawValue
  for (auto member : structDecl->getMembers())
    if (auto varDecl = dyn_cast<VarDecl>(member))
      if (varDecl->getName().str() == "rawValue")
        return varDecl->getType();

  return {};
}

ClassDecl *ClassDecl::getSuperclassDecl() const {
  if (auto superclass = getSuperclass())
    return superclass->getClassOrBoundGenericClass();
  return nullptr;
}

void ClassDecl::setSuperclass(Type superclass) {
  assert((!superclass || !superclass->hasArchetype())
         && "superclass must be interface type");
  LazySemanticInfo.Superclass.setPointerAndInt(superclass, true);
}
```
</details>
<details>
<summary>Stack trace:</summary>
```
swift: /path/to/swift/lib/AST/Decl.cpp:4765: void swift::ClassDecl::setSuperclass(swift::Type): Assertion `(!superclass || !superclass->hasArchetype()) && "superclass must be interface type"' failed.
9  swift           0x0000000000fe724d swift::IterativeTypeChecker::processTypeCheckSuperclass(swift::ClassDecl*, llvm::function_ref<bool (swift::TypeCheckRequest)>) + 269
10 swift           0x0000000000fbf0dd swift::IterativeTypeChecker::satisfy(swift::TypeCheckRequest) + 493
11 swift           0x0000000000eaaca0 swift::TypeChecker::resolveSuperclass(swift::ClassDecl*) + 64
12 swift           0x0000000001131899 swift::ConformanceLookupTable::updateLookupTable(swift::NominalTypeDecl*, swift::ConformanceLookupTable::ConformanceStage, swift::LazyResolver*) + 217
13 swift           0x0000000001131df2 swift::ConformanceLookupTable::updateLookupTable(swift::NominalTypeDecl*, swift::ConformanceLookupTable::ConformanceStage, swift::LazyResolver*) + 1586
14 swift           0x0000000001135a3e swift::ConformanceLookupTable::getAllProtocols(swift::NominalTypeDecl*, swift::LazyResolver*, llvm::SmallVectorImpl<swift::ProtocolDecl*>&) + 30
15 swift           0x000000000111756f swift::NominalTypeDecl::getAllProtocols() const + 95
16 swift           0x000000000110bf10 swift::DeclContext::lookupQualified(swift::Type, swift::DeclName, swift::NLOptions, swift::LazyResolver*, llvm::SmallVectorImpl<swift::ValueDecl*>&) const + 3104
17 swift           0x0000000000eeffaa swift::TypeChecker::lookupMemberType(swift::DeclContext*, swift::Type, swift::Identifier, swift::OptionSet<swift::NameLookupFlags, unsigned int>) + 298
19 swift           0x0000000000f2079e swift::TypeChecker::resolveIdentifierType(swift::DeclContext*, swift::IdentTypeRepr*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, bool, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 158
21 swift           0x0000000000f216f4 swift::TypeChecker::resolveType(swift::TypeRepr*, swift::DeclContext*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 164
22 swift           0x0000000000f20690 swift::TypeChecker::validateType(swift::TypeLoc&, swift::DeclContext*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 192
24 swift           0x0000000000eeb21e swift::TypeChecker::validateGenericFuncSignature(swift::AbstractFunctionDecl*) + 94
27 swift           0x0000000000eada93 swift::TypeChecker::validateDecl(swift::ValueDecl*, bool) + 947
29 swift           0x0000000000eae424 swift::TypeChecker::validateDecl(swift::ValueDecl*, bool) + 3396
30 swift           0x000000000110bd5b swift::DeclContext::lookupQualified(swift::Type, swift::DeclName, swift::NLOptions, swift::LazyResolver*, llvm::SmallVectorImpl<swift::ValueDecl*>&) const + 2667
31 swift           0x000000000110a5fb swift::UnqualifiedLookup::UnqualifiedLookup(swift::DeclName, swift::DeclContext*, swift::LazyResolver*, bool, swift::SourceLoc, bool, bool) + 2491
32 swift           0x0000000000eef27b swift::TypeChecker::lookupUnqualified(swift::DeclContext*, swift::DeclName, swift::SourceLoc, swift::OptionSet<swift::NameLookupFlags, unsigned int>) + 187
35 swift           0x0000000000f2079e swift::TypeChecker::resolveIdentifierType(swift::DeclContext*, swift::IdentTypeRepr*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, bool, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 158
37 swift           0x0000000000f216f4 swift::TypeChecker::resolveType(swift::TypeRepr*, swift::DeclContext*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 164
38 swift           0x0000000000f20690 swift::TypeChecker::validateType(swift::TypeLoc&, swift::DeclContext*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 192
39 swift           0x0000000000eac25a swift::TypeChecker::checkInheritanceClause(swift::Decl*, swift::GenericTypeResolver*) + 5130
40 swift           0x0000000000ead858 swift::TypeChecker::validateDecl(swift::ValueDecl*, bool) + 376
41 swift           0x000000000110bd5b swift::DeclContext::lookupQualified(swift::Type, swift::DeclName, swift::NLOptions, swift::LazyResolver*, llvm::SmallVectorImpl<swift::ValueDecl*>&) const + 2667
42 swift           0x000000000110a5fb swift::UnqualifiedLookup::UnqualifiedLookup(swift::DeclName, swift::DeclContext*, swift::LazyResolver*, bool, swift::SourceLoc, bool, bool) + 2491
43 swift           0x0000000000eef27b swift::TypeChecker::lookupUnqualified(swift::DeclContext*, swift::DeclName, swift::SourceLoc, swift::OptionSet<swift::NameLookupFlags, unsigned int>) + 187
47 swift           0x0000000000f2079e swift::TypeChecker::resolveIdentifierType(swift::DeclContext*, swift::IdentTypeRepr*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, bool, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 158
49 swift           0x0000000000f216f4 swift::TypeChecker::resolveType(swift::TypeRepr*, swift::DeclContext*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 164
50 swift           0x0000000000f20690 swift::TypeChecker::validateType(swift::TypeLoc&, swift::DeclContext*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 192
52 swift           0x0000000000eeb21e swift::TypeChecker::validateGenericFuncSignature(swift::AbstractFunctionDecl*) + 94
59 swift           0x0000000000eb2e86 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 150
60 swift           0x0000000000ed5012 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) + 1026
61 swift           0x0000000000c61999 swift::CompilerInstance::performSema() + 3289
63 swift           0x00000000007d8599 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2857
64 swift           0x00000000007a45b8 main + 2872
Stack dump:
0.	Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28357-swift-iterativetypechecker-processtypechecksuperclass.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28357-swift-iterativetypechecker-processtypechecksuperclass-de5782.o
1.	While type-checking 'B' at validation-test/compiler_crashers/28357-swift-iterativetypechecker-processtypechecksuperclass.swift:10:1
2.	While resolving type A.h at [validation-test/compiler_crashers/28357-swift-iterativetypechecker-processtypechecksuperclass.swift:10:26 - line:10:28] RangeText="A.h"
3.	While resolving type d at [validation-test/compiler_crashers/28357-swift-iterativetypechecker-processtypechecksuperclass.swift:10:39 - line:10:39] RangeText="d"
4.	While type-checking 'd' at validation-test/compiler_crashers/28357-swift-iterativetypechecker-processtypechecksuperclass.swift:10:41
5.	While type-checking 'd' at validation-test/compiler_crashers/28357-swift-iterativetypechecker-processtypechecksuperclass.swift:10:19
6.	While resolving type A.h at [validation-test/compiler_crashers/28357-swift-iterativetypechecker-processtypechecksuperclass.swift:10:26 - line:10:28] RangeText="A.h"
<unknown>:0: error: unable to execute command: Aborted
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
```
</details>
2016-07-08 17:51:31 +02:00
practicalswift
8d90eac104 Add 💥 (😢 → 58, 😀 → 5107) in swift::GenericSignature::getSubstitutionMap(…)
Add test case for crash triggered in `swift::GenericSignature::getSubstitutionMap(…)`.

Assertion failure in [`lib/AST/GenericSignature.cpp (line 413)`](https://github.com/apple/swift/blob/master/lib/AST/GenericSignature.cpp#L413):

```
Assertion `args.empty() && "did not use all substitutions?!"' failed.

When executing: TypeSubstitutionMap swift::GenericSignature::getSubstitutionMap(ArrayRef<swift::Substitution>) const
```

<details>
<summary>Assertion context:</summary>
```
  // An empty parameter list gives an empty map.
  if (getGenericParams().empty()) {
    assert(args.empty() && "substitutions but no generic params?!");
    return subs;
  }

  // Seed the type map with pre-existing substitutions.
  for (auto depTy : getAllDependentTypes()) {
    auto replacement = args.front().getReplacement();
    args = args.slice(1);

    if (auto subTy = depTy->getAs<SubstitutableType>()) {
      subs[subTy->getCanonicalType().getPointer()] = replacement;
    }
    else if (auto dTy = depTy->getAs<DependentMemberType>()) {
      subs[dTy->getCanonicalType().getPointer()] = replacement;
    }
  }

  assert(args.empty() && "did not use all substitutions?!");
```
</details>
<details>
<summary>Stack trace:</summary>
```
swift: /path/to/swift/lib/AST/GenericSignature.cpp:413: TypeSubstitutionMap swift::GenericSignature::getSubstitutionMap(ArrayRef<swift::Substitution>) const: Assertion `args.empty() && "did not use all substitutions?!"' failed.
8  swift           0x00000000010e5a13 swift::GenericSignature::getSubstitutionMap(llvm::ArrayRef<swift::Substitution>) const + 659
9  swift           0x000000000111fe47 swift::TypeBase::getSuperclass(swift::LazyResolver*) + 215
10 swift           0x00000000011337d2 swift::ConformanceLookupTable::getConformance(swift::NominalTypeDecl*, swift::LazyResolver*, swift::ConformanceLookupTable::ConformanceEntry*) + 290
12 swift           0x0000000001133ef4 swift::ConformanceLookupTable::lookupConformances(swift::NominalTypeDecl*, swift::DeclContext*, swift::LazyResolver*, swift::ConformanceLookupKind, llvm::SmallVectorImpl<swift::ProtocolDecl*>*, llvm::SmallVectorImpl<swift::ProtocolConformance*>*, llvm::SmallVectorImpl<swift::ConformanceDiagnostic>*) + 692
13 swift           0x0000000001116274 swift::DeclContext::getLocalConformances(swift::ConformanceLookupKind, llvm::SmallVectorImpl<swift::ConformanceDiagnostic>*, bool) const + 212
14 swift           0x0000000000efa8fa swift::TypeChecker::findWitnessedObjCRequirements(swift::ValueDecl const*, bool) + 122
26 swift           0x0000000000eb1686 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 150
29 swift           0x0000000000f17bca swift::TypeChecker::typeCheckFunctionBodyUntil(swift::FuncDecl*, swift::SourceLoc) + 346
30 swift           0x0000000000f17a2e swift::TypeChecker::typeCheckAbstractFunctionBodyUntil(swift::AbstractFunctionDecl*, swift::SourceLoc) + 46
31 swift           0x0000000000f185f3 swift::TypeChecker::typeCheckAbstractFunctionBody(swift::AbstractFunctionDecl*) + 179
33 swift           0x0000000000ed38e1 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) + 1281
34 swift           0x0000000000c60b89 swift::CompilerInstance::performSema() + 3289
36 swift           0x00000000007d8429 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2857
37 swift           0x00000000007a4458 main + 2872
Stack dump:
0.	Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28355-swift-genericsignature-getsubstitutionmap.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28355-swift-genericsignature-getsubstitutionmap-792793.o
1.	While type-checking 'a' at validation-test/compiler_crashers/28355-swift-genericsignature-getsubstitutionmap.swift:10:1
2.	While type-checking 'A' at validation-test/compiler_crashers/28355-swift-genericsignature-getsubstitutionmap.swift:10:8
<unknown>:0: error: unable to execute command: Aborted
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
```
</details>
2016-07-08 01:09:56 +02:00
practicalswift
7858c691cf Add 💥 (😢 → 57, 😀 → 5107) in swift::ConformanceLookupTable::lookupConformances(…)
Add test case for crash triggered in `swift::ConformanceLookupTable::lookupConformances(…)`.

Assertion failure in `llvm/include/llvm/ADT/Optional.h (line 120)`:

```
Assertion `hasVal' failed.

When executing: T *llvm::Optional<swift::ProtocolConformanceRef>::getPointer() [T = swift::ProtocolConformanceRef]
```

<details>
<summary>Assertion context:</summary>
```
    if (!O)
      reset();
    else
      *this = *O;
    return *this;
  }

  void reset() {
    if (hasVal) {
      (**this).~T();
      hasVal = false;
    }
  }

  ~Optional() {
    reset();
  }

  const T* getPointer() const { assert(hasVal); return reinterpret_cast<const T*>(storage.buffer); }
  T* getPointer() { assert(hasVal); return reinterpret_cast<T*>(storage.buffer); }
```
</details>
<details>
<summary>Stack trace:</summary>
```
swift: /path/to/llvm/include/llvm/ADT/Optional.h:120: T *llvm::Optional<swift::ProtocolConformanceRef>::getPointer() [T = swift::ProtocolConformanceRef]: Assertion `hasVal' failed.
10 swift           0x0000000001133ef4 swift::ConformanceLookupTable::lookupConformances(swift::NominalTypeDecl*, swift::DeclContext*, swift::LazyResolver*, swift::ConformanceLookupKind, llvm::SmallVectorImpl<swift::ProtocolDecl*>*, llvm::SmallVectorImpl<swift::ProtocolConformance*>*, llvm::SmallVectorImpl<swift::ConformanceDiagnostic>*) + 692
11 swift           0x0000000001116274 swift::DeclContext::getLocalConformances(swift::ConformanceLookupKind, llvm::SmallVectorImpl<swift::ConformanceDiagnostic>*, bool) const + 212
12 swift           0x0000000000efa8fa swift::TypeChecker::findWitnessedObjCRequirements(swift::ValueDecl const*, bool) + 122
14 swift           0x0000000000eaeedb swift::markAsObjC(swift::TypeChecker&, swift::ValueDecl*, llvm::Optional<swift::ObjCReason>, llvm::Optional<swift::ForeignErrorConvention>) + 987
17 swift           0x0000000000eb1686 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 150
18 swift           0x0000000000f32dbe swift::TypeChecker::addImplicitDestructor(swift::ClassDecl*) + 126
21 swift           0x0000000000eb1686 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 150
24 swift           0x0000000000f17bca swift::TypeChecker::typeCheckFunctionBodyUntil(swift::FuncDecl*, swift::SourceLoc) + 346
25 swift           0x0000000000f17a2e swift::TypeChecker::typeCheckAbstractFunctionBodyUntil(swift::AbstractFunctionDecl*, swift::SourceLoc) + 46
26 swift           0x0000000000f185f3 swift::TypeChecker::typeCheckAbstractFunctionBody(swift::AbstractFunctionDecl*) + 179
28 swift           0x0000000000ed38e1 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) + 1281
29 swift           0x0000000000c60b89 swift::CompilerInstance::performSema() + 3289
31 swift           0x00000000007d8429 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2857
32 swift           0x00000000007a4458 main + 2872
Stack dump:
0.	Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28354-swift-conformancelookuptable-lookupconformances.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28354-swift-conformancelookuptable-lookupconformances-9d940c.o
1.	While type-checking 'B' at validation-test/compiler_crashers/28354-swift-conformancelookuptable-lookupconformances.swift:10:1
2.	While type-checking 'A' at validation-test/compiler_crashers/28354-swift-conformancelookuptable-lookupconformances.swift:10:30
3.	While type-checking 'deinit' at validation-test/compiler_crashers/28354-swift-conformancelookuptable-lookupconformances.swift:10:36
<unknown>:0: error: unable to execute command: Aborted
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
```
</details>
2016-07-08 01:07:44 +02:00
practicalswift
d48e920448 Add 💥 (😢 → 56, 😀 → 5107) in swift::removeOverriddenDecls(…)
Add test case for crash triggered in `swift::removeOverriddenDecls(…)`.

Assertion failure in [`lib/AST/NameLookup.cpp (line 76)`](https://github.com/apple/swift/blob/master/lib/AST/NameLookup.cpp#L76):

```
Assertion `decl != overrides && "Circular class inheritance?"' failed.

When executing: bool swift::removeOverriddenDecls(SmallVectorImpl<swift::ValueDecl *> &)
```

<details>
<summary>Assertion context:</summary>
```
bool swift::removeOverriddenDecls(SmallVectorImpl<ValueDecl*> &decls) {
  if (decls.empty())
    return false;

  ASTContext &ctx = decls.front()->getASTContext();
  llvm::SmallPtrSet<ValueDecl*, 8> overridden;
  for (auto decl : decls) {
    while (auto overrides = decl->getOverriddenDecl()) {
      overridden.insert(overrides);

      // Because initializers from Objective-C base classes have greater
      // visibility than initializers written in Swift classes, we can
      // have a "break" in the set of declarations we found, where
      // C.init overrides B.init overrides A.init, but only C.init and
      // A.init are in the chain. Make sure we still remove A.init from the
      // set in this case.
      if (decl->getFullName().getBaseName() == ctx.Id_init) {
        /// FIXME: Avoid the possibility of an infinite loop by fixing the root
        ///        cause instead (incomplete circularity detection).
        assert(decl != overrides && "Circular class inheritance?");
```
</details>
<details>
<summary>Stack trace:</summary>
```
swift: /path/to/swift/lib/AST/NameLookup.cpp:76: bool swift::removeOverriddenDecls(SmallVectorImpl<swift::ValueDecl *> &): Assertion `decl != overrides && "Circular class inheritance?"' failed.
8  swift           0x0000000001106dd8 swift::removeOverriddenDecls(llvm::SmallVectorImpl<swift::ValueDecl*>&) + 1432
11 swift           0x0000000000eee438 swift::TypeChecker::lookupMember(swift::DeclContext*, swift::Type, swift::DeclName, swift::OptionSet<swift::NameLookupFlags, unsigned int>) + 408
12 swift           0x0000000000eeed9d swift::TypeChecker::lookupConstructors(swift::DeclContext*, swift::Type, swift::OptionSet<swift::NameLookupFlags, unsigned int>) + 45
13 swift           0x0000000000eb71d6 swift::TypeChecker::addImplicitConstructors(swift::NominalTypeDecl*) + 1350
14 swift           0x0000000000eaad2e swift::TypeChecker::checkInheritanceClause(swift::Decl*, swift::GenericTypeResolver*) + 5854
15 swift           0x0000000000eac058 swift::TypeChecker::validateDecl(swift::ValueDecl*, bool) + 376
19 swift           0x0000000000f1ef6e swift::TypeChecker::resolveIdentifierType(swift::DeclContext*, swift::IdentTypeRepr*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, bool, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 158
21 swift           0x0000000000f1fec4 swift::TypeChecker::resolveType(swift::TypeRepr*, swift::DeclContext*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 164
22 swift           0x0000000000f1ee60 swift::TypeChecker::validateType(swift::TypeLoc&, swift::DeclContext*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 192
23 swift           0x0000000000fe586f swift::IterativeTypeChecker::processResolveInheritedClauseEntry(std::pair<llvm::PointerUnion<swift::TypeDecl*, swift::ExtensionDecl*>, unsigned int>, llvm::function_ref<bool (swift::TypeCheckRequest)>) + 159
24 swift           0x0000000000fbd8ad swift::IterativeTypeChecker::satisfy(swift::TypeCheckRequest) + 493
25 swift           0x0000000000ea9609 swift::TypeChecker::resolveInheritanceClause(llvm::PointerUnion<swift::TypeDecl*, swift::ExtensionDecl*>) + 137
26 swift           0x0000000000eac37f swift::TypeChecker::validateDecl(swift::ValueDecl*, bool) + 1183
31 swift           0x0000000000eb1686 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 150
34 swift           0x0000000000f17bca swift::TypeChecker::typeCheckFunctionBodyUntil(swift::FuncDecl*, swift::SourceLoc) + 346
35 swift           0x0000000000f17a2e swift::TypeChecker::typeCheckAbstractFunctionBodyUntil(swift::AbstractFunctionDecl*, swift::SourceLoc) + 46
36 swift           0x0000000000f185f3 swift::TypeChecker::typeCheckAbstractFunctionBody(swift::AbstractFunctionDecl*) + 179
38 swift           0x0000000000ed38e1 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) + 1281
39 swift           0x0000000000c60b89 swift::CompilerInstance::performSema() + 3289
41 swift           0x00000000007d8429 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2857
42 swift           0x00000000007a4458 main + 2872
Stack dump:
0.	Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28353-swift-removeoverriddendecls.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28353-swift-removeoverriddendecls-e20d37.o
1.	While type-checking getter for E at validation-test/compiler_crashers/28353-swift-removeoverriddendecls.swift:10:6
2.	While type-checking 'C' at validation-test/compiler_crashers/28353-swift-removeoverriddendecls.swift:10:7
3.	While resolving type A at [validation-test/compiler_crashers/28353-swift-removeoverriddendecls.swift:14:15 - line:14:15] RangeText="A"
<unknown>:0: error: unable to execute command: Aborted
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
```
</details>
2016-07-08 01:02:24 +02:00
practicalswift
4901ce5a13 Add 💥 (😢 → 55, 😀 → 5107) in swift::TypeChecker::configureInterfaceType(…)
Add test case for crash triggered in `swift::TypeChecker::configureInterfaceType(…)`.

Assertion failure in [`lib/AST/Parameter.cpp (line 154)`](https://github.com/apple/swift/blob/master/lib/AST/Parameter.cpp#L154):

```
Assertion `!type->hasArchetype()' failed.

When executing: swift::Type swift::ParameterList::getInterfaceType(swift::DeclContext *) const
```

<details>
<summary>Assertion context:</summary>
```
/// containing contextual types.
Type ParameterList::getInterfaceType(DeclContext *DC) const {
  auto &C = DC->getASTContext();

  if (size() == 0)
    return TupleType::getEmpty(C);

  SmallVector<TupleTypeElt, 8> argumentInfo;

  for (auto P : *this) {
    assert(P->hasType());

    Type type;
    if (P->hasInterfaceType())
      type = P->getInterfaceType();
    else if (!P->getTypeLoc().hasLocation())
      type = ArchetypeBuilder::mapTypeOutOfContext(DC, P->getType());
    else
      type = P->getType();
    assert(!type->hasArchetype());
```
</details>
<details>
<summary>Stack trace:</summary>
```
swift: /path/to/swift/lib/AST/Parameter.cpp:154: swift::Type swift::ParameterList::getInterfaceType(swift::DeclContext *) const: Assertion `!type->hasArchetype()' failed.
9  swift           0x0000000000eea501 swift::TypeChecker::configureInterfaceType(swift::AbstractFunctionDecl*) + 625
10 swift           0x0000000000ee9d31 swift::TypeChecker::validateGenericFuncSignature(swift::AbstractFunctionDecl*) + 929
13 swift           0x0000000000eb1686 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 150
14 swift           0x0000000000f3191b swift::createImplicitConstructor(swift::TypeChecker&, swift::NominalTypeDecl*, swift::ImplicitConstructorKind) + 1371
15 swift           0x0000000000eb7290 swift::TypeChecker::addImplicitConstructors(swift::NominalTypeDecl*) + 1536
18 swift           0x0000000000eb1686 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 150
21 swift           0x0000000000f17bca swift::TypeChecker::typeCheckFunctionBodyUntil(swift::FuncDecl*, swift::SourceLoc) + 346
22 swift           0x0000000000f17a2e swift::TypeChecker::typeCheckAbstractFunctionBodyUntil(swift::AbstractFunctionDecl*, swift::SourceLoc) + 46
23 swift           0x0000000000f185f3 swift::TypeChecker::typeCheckAbstractFunctionBody(swift::AbstractFunctionDecl*) + 179
25 swift           0x0000000000ed38e1 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) + 1281
26 swift           0x0000000000c60b89 swift::CompilerInstance::performSema() + 3289
28 swift           0x00000000007d8429 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2857
29 swift           0x00000000007a4458 main + 2872
Stack dump:
0.	Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28352-swift-typechecker-configureinterfacetype.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28352-swift-typechecker-configureinterfacetype-226407.o
1.	While type-checking 'a' at validation-test/compiler_crashers/28352-swift-typechecker-configureinterfacetype.swift:10:28
2.	While type-checking 'A' at validation-test/compiler_crashers/28352-swift-typechecker-configureinterfacetype.swift:10:35
3.	While type-checking 'init' at validation-test/compiler_crashers/28352-swift-typechecker-configureinterfacetype.swift:10:42
<unknown>:0: error: unable to execute command: Aborted
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
```
</details>
2016-07-08 01:00:09 +02:00
practicalswift
c5d8f126be Add 💥 (😢 → 54, 😀 → 5107) in swift::FunctionType::get(…)
Add test case for crash triggered in `swift::FunctionType::get(…)`.

<details>
<summary>Stack trace:</summary>
```
4  swift           0x000000000100595b swift::FunctionType::get(swift::Type, swift::Type, swift::AnyFunctionType::ExtInfo const&) + 27
5  swift           0x0000000000f3d4a5 swift::constraints::ConstraintSystem::getTypeOfMemberReference(swift::Type, swift::ValueDecl*, bool, bool, swift::constraints::ConstraintLocatorBuilder, swift::DeclRefExpr const*, llvm::DenseMap<swift::CanType, swift::TypeVariableType*, llvm::DenseMapInfo<swift::CanType>, llvm::detail::DenseMapPair<swift::CanType, swift::TypeVariableType*> >*) + 2309
10 swift           0x0000000000efb560 swift::TypeChecker::inferDefaultWitnesses(swift::ProtocolDecl*) + 288
11 swift           0x0000000000ed3ee8 swift::finishTypeChecking(swift::SourceFile&) + 536
12 swift           0x0000000000c60d3a swift::CompilerInstance::performSema() + 3722
14 swift           0x00000000007d8429 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2857
15 swift           0x00000000007a4458 main + 2872
Stack dump:
0.	Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28351-swift-functiontype-get.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28351-swift-functiontype-get-b083da.o
<unknown>:0: error: unable to execute command: Segmentation fault
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
```
</details>
2016-07-08 00:58:32 +02:00
practicalswift
faade7c9ee Add 💥 (😢 → 53, 😀 → 5107) in swift::TypeChecker::performTypoCorrection(…)
Add test case for crash triggered in `swift::TypeChecker::performTypoCorrection(…)`.

Assertion failure in [`lib/AST/LookupVisibleDecls.cpp (line 566)`](https://github.com/apple/swift/blob/master/lib/AST/LookupVisibleDecls.cpp#L566):

```
Assertion `BaseTy.getPointer() != CurClass->getSuperclass().getPointer() && "type is its own superclass"' failed.

When executing: void lookupVisibleMemberDeclsImpl(swift::Type, swift::VisibleDeclConsumer &, const swift::DeclContext *, (anonymous namespace)::LookupState, swift::DeclVisibilityKind, swift::LazyResolver *, VisitedSet &)
```

<details>
<summary>Assertion context:</summary>
```
                                   Visited);
    return;
  }

  do {
    NominalTypeDecl *CurNominal = BaseTy->getAnyNominal();
    if (!CurNominal)
      break;

    // Look in for members of a nominal type.
    lookupTypeMembers(BaseTy, BaseTy, Consumer, CurrDC, LS, Reason,
                      TypeResolver);
    lookupDeclsFromProtocolsBeingConformedTo(BaseTy, Consumer, LS, CurrDC,
                                             Reason, TypeResolver, Visited);
    // If we have a class type, look into its superclass.
    ClassDecl *CurClass = dyn_cast<ClassDecl>(CurNominal);

    if (CurClass && CurClass->hasSuperclass()) {
      assert(BaseTy.getPointer() != CurClass->getSuperclass().getPointer() &&
             "type is its own superclass");
```
</details>
<details>
<summary>Stack trace:</summary>
```
swift: /path/to/swift/lib/AST/LookupVisibleDecls.cpp:566: void lookupVisibleMemberDeclsImpl(swift::Type, swift::VisibleDeclConsumer &, const swift::DeclContext *, (anonymous namespace)::LookupState, swift::DeclVisibilityKind, swift::LazyResolver *, VisitedSet &): Assertion `BaseTy.getPointer() != CurClass->getSuperclass().getPointer() && "type is its own superclass"' failed.
10 swift           0x0000000000eeeeeb swift::TypeChecker::performTypoCorrection(swift::DeclContext*, swift::DeclRefKind, swift::Type, swift::DeclName, swift::SourceLoc, swift::OptionSet<swift::NameLookupFlags, unsigned int>, swift::LookupResult&, unsigned int) + 267
12 swift           0x0000000000f63c52 swift::constraints::ConstraintSystem::diagnoseFailureForExpr(swift::Expr*) + 8738
13 swift           0x0000000000f6741e swift::constraints::ConstraintSystem::salvage(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::Expr*) + 3998
14 swift           0x0000000000e99512 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>) + 850
15 swift           0x0000000000e9fc72 swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*) + 610
16 swift           0x0000000000ea0e27 swift::TypeChecker::typeCheckBinding(swift::Pattern*&, swift::Expr*&, swift::DeclContext*) + 343
17 swift           0x0000000000ea103b swift::TypeChecker::typeCheckPatternBinding(swift::PatternBindingDecl*, unsigned int) + 267
19 swift           0x0000000000eacded swift::TypeChecker::validateDecl(swift::ValueDecl*, bool) + 3853
20 swift           0x0000000000f3155d swift::createImplicitConstructor(swift::TypeChecker&, swift::NominalTypeDecl*, swift::ImplicitConstructorKind) + 413
21 swift           0x0000000000eb7290 swift::TypeChecker::addImplicitConstructors(swift::NominalTypeDecl*) + 1536
24 swift           0x0000000000eb1686 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 150
25 swift           0x0000000000ed37e2 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) + 1026
26 swift           0x0000000000c60b89 swift::CompilerInstance::performSema() + 3289
28 swift           0x00000000007d8429 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2857
29 swift           0x00000000007a4458 main + 2872
Stack dump:
0.	Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28350-swift-typechecker-performtypocorrection.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28350-swift-typechecker-performtypocorrection-9b1949.o
1.	While type-checking 'c' at validation-test/compiler_crashers/28350-swift-typechecker-performtypocorrection.swift:10:1
2.	While type-checking expression at [validation-test/compiler_crashers/28350-swift-typechecker-performtypocorrection.swift:10:27 - line:10:29] RangeText="A.s"
<unknown>:0: error: unable to execute command: Aborted
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
```
</details>
2016-07-08 00:51:33 +02:00
practicalswift
1d796abed1 Add 💥 (😢 → 52, 😀 → 5107) in swift::TypeBase::gatherAllSubstitutions(…)
Add test case for crash triggered in `swift::TypeBase::gatherAllSubstitutions(…)`.

<details>
<summary>Stack trace:</summary>
```
6  swift           0x00000000032b06dd llvm::llvm_unreachable_internal(char const*, char const*, unsigned int) + 461
7  swift           0x00000000010fa10e swift::TypeBase::gatherAllSubstitutions(swift::ModuleDecl*, swift::LazyResolver*, swift::DeclContext*) + 4398
8  swift           0x000000000111fe31 swift::TypeBase::getSuperclass(swift::LazyResolver*) + 193
9  swift           0x0000000000fa0c20 swift::constraints::ConstraintSystem::matchSuperclassTypes(swift::Type, swift::Type, swift::constraints::TypeMatchKind, unsigned int, swift::constraints::ConstraintLocatorBuilder) + 64
10 swift           0x0000000000fa1aeb swift::constraints::ConstraintSystem::simplifyRestrictedConstraint(swift::constraints::ConversionRestrictionKind, swift::Type, swift::Type, swift::constraints::TypeMatchKind, unsigned int, swift::constraints::ConstraintLocatorBuilder) + 1227
11 swift           0x0000000000f9ecd2 swift::constraints::ConstraintSystem::matchTypes(swift::Type, swift::Type, swift::constraints::TypeMatchKind, unsigned int, swift::constraints::ConstraintLocatorBuilder) + 10674
12 swift           0x0000000000fa8712 swift::constraints::ConstraintSystem::simplifyConstraint(swift::constraints::Constraint const&) + 626
13 swift           0x0000000000f3aa77 swift::constraints::ConstraintSystem::addConstraint(swift::constraints::Constraint*, bool, bool) + 23
14 swift           0x0000000000f3d74c swift::constraints::ConstraintSystem::getTypeOfMemberReference(swift::Type, swift::ValueDecl*, bool, bool, swift::constraints::ConstraintLocatorBuilder, swift::DeclRefExpr const*, llvm::DenseMap<swift::CanType, swift::TypeVariableType*, llvm::DenseMapInfo<swift::CanType>, llvm::detail::DenseMapPair<swift::CanType, swift::TypeVariableType*> >*) + 2988
15 swift           0x0000000000f3e134 swift::constraints::ConstraintSystem::resolveOverload(swift::constraints::ConstraintLocator*, swift::Type, swift::constraints::OverloadChoice) + 516
16 swift           0x0000000000fa8829 swift::constraints::ConstraintSystem::simplifyConstraint(swift::constraints::Constraint const&) + 905
17 swift           0x0000000000f3aa77 swift::constraints::ConstraintSystem::addConstraint(swift::constraints::Constraint*, bool, bool) + 23
18 swift           0x0000000000f3dec7 swift::constraints::ConstraintSystem::addOverloadSet(swift::Type, llvm::ArrayRef<swift::constraints::OverloadChoice>, swift::constraints::ConstraintLocator*, swift::constraints::OverloadChoice*) + 327
19 swift           0x0000000000fa73d3 swift::constraints::ConstraintSystem::simplifyMemberConstraint(swift::constraints::Constraint const&) + 563
20 swift           0x0000000000fa84e4 swift::constraints::ConstraintSystem::simplifyConstraint(swift::constraints::Constraint const&) + 68
21 swift           0x0000000000f3aa77 swift::constraints::ConstraintSystem::addConstraint(swift::constraints::Constraint*, bool, bool) + 23
24 swift           0x0000000001066795 swift::Expr::walk(swift::ASTWalker&) + 69
25 swift           0x0000000000f84738 swift::constraints::ConstraintSystem::generateConstraints(swift::Expr*) + 200
26 swift           0x0000000000e99333 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>) + 371
27 swift           0x0000000000e9fc72 swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*) + 610
30 swift           0x0000000000f17bca swift::TypeChecker::typeCheckFunctionBodyUntil(swift::FuncDecl*, swift::SourceLoc) + 346
31 swift           0x0000000000f17a2e swift::TypeChecker::typeCheckAbstractFunctionBodyUntil(swift::AbstractFunctionDecl*, swift::SourceLoc) + 46
32 swift           0x0000000000f185f3 swift::TypeChecker::typeCheckAbstractFunctionBody(swift::AbstractFunctionDecl*) + 179
34 swift           0x0000000000ed38e1 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) + 1281
35 swift           0x0000000000c60b89 swift::CompilerInstance::performSema() + 3289
37 swift           0x00000000007d8429 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2857
38 swift           0x00000000007a4458 main + 2872
Stack dump:
0.	Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28349-swift-typebase-gatherallsubstitutions.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28349-swift-typebase-gatherallsubstitutions-4b98db.o
1.	While type-checking getter for a at validation-test/compiler_crashers/28349-swift-typebase-gatherallsubstitutions.swift:9:42
2.	While type-checking expression at [validation-test/compiler_crashers/28349-swift-typebase-gatherallsubstitutions.swift:9:43 - line:9:43] RangeText="b"
<unknown>:0: error: unable to execute command: Aborted
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
```
</details>
2016-07-07 19:24:06 +02:00
practicalswift
ff646010f6 Merge pull request #3383 from practicalswift/swiftc-28348-swift-typechecker-validatedecl
Add 💥 (😢 → 50, 😀 → 5107) in swift::TypeChecker::validateDecl(…)
2016-07-07 19:23:03 +02:00
practicalswift
4bc4f51a07 Merge pull request #3367 from practicalswift/swiftc-28347-swift-typechecker-checkinheritanceclause
Add 💥 (😢 → 58, 😀 → 5099) in swift::TypeChecker::checkInheritanceClause(…)
2016-07-07 10:43:53 +02:00
practicalswift
af7cb57d95 Add 💥 (😢 → 50, 😀 → 5107) in swift::TypeChecker::validateDecl(…)
Add test case for crash triggered in `swift::TypeChecker::validateDecl(…)`.

Assertion failure:
```
swift: /path/to/swift/lib/AST/ArchetypeBuilder.cpp:2109: static swift::Type swift::ArchetypeBuilder::mapTypeOutOfContext(swift::ModuleDecl *, swift::GenericParamList *, swift::Type): Assertion `!type->hasArchetype() && "not fully substituted"' failed.
```

<details>
<summary>Stack trace:</summary>
```
swift: /path/to/swift/lib/AST/ArchetypeBuilder.cpp:2109: static swift::Type swift::ArchetypeBuilder::mapTypeOutOfContext(swift::ModuleDecl *, swift::GenericParamList *, swift::Type): Assertion `!type->hasArchetype() && "not fully substituted"' failed.
11 swift           0x0000000000eac9cd swift::TypeChecker::validateDecl(swift::ValueDecl*, bool) + 3853
12 swift           0x0000000000f3117d swift::createImplicitConstructor(swift::TypeChecker&, swift::NominalTypeDecl*, swift::ImplicitConstructorKind) + 413
13 swift           0x0000000000eb6e70 swift::TypeChecker::addImplicitConstructors(swift::NominalTypeDecl*) + 1536
18 swift           0x0000000000eb1266 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 150
21 swift           0x0000000000f18b24 swift::TypeChecker::typeCheckClosureBody(swift::ClosureExpr*) + 244
22 swift           0x0000000000f44e3c swift::constraints::ConstraintSystem::applySolution(swift::constraints::Solution&, swift::Expr*, swift::Type, bool, bool, bool) + 876
23 swift           0x0000000000e9f8f1 swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*) + 769
26 swift           0x0000000000f177aa swift::TypeChecker::typeCheckFunctionBodyUntil(swift::FuncDecl*, swift::SourceLoc) + 346
27 swift           0x0000000000f1760e swift::TypeChecker::typeCheckAbstractFunctionBodyUntil(swift::AbstractFunctionDecl*, swift::SourceLoc) + 46
28 swift           0x0000000000f181d3 swift::TypeChecker::typeCheckAbstractFunctionBody(swift::AbstractFunctionDecl*) + 179
30 swift           0x0000000000ed34c1 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) + 1281
31 swift           0x0000000000c60769 swift::CompilerInstance::performSema() + 3289
33 swift           0x00000000007d8429 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2857
34 swift           0x00000000007a4458 main + 2872
Stack dump:
0.	Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28348-swift-typechecker-validatedecl.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28348-swift-typechecker-validatedecl-2bcb22.o
1.	While type-checking declaration 0x6a96ac0 at validation-test/compiler_crashers/28348-swift-typechecker-validatedecl.swift:10:5
2.	While type-checking expression at [validation-test/compiler_crashers/28348-swift-typechecker-validatedecl.swift:10:6 - line:12:16] RangeText="{enum S<T{{
3.	While type-checking 'S' at validation-test/compiler_crashers/28348-swift-typechecker-validatedecl.swift:10:7
<unknown>:0: error: unable to execute command: Aborted
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
```
</details>
2016-07-07 10:10:27 +02:00
swift-ci
3cb429bc5c Merge pull request #3377 from gregomni/28291 2016-07-07 00:44:25 -07:00
gregomni
5bb61795b6 Mark decls that are illegal due to generic inside non-generic decl or non-generic inside generic decl with setInvalid(), and avoid assertions
trying to set the superclass on classes in such situations by setting the superclass of an invalid decl to the error type.

This fixes a bunch of compiler crashes, and also changes some errors in other tests where the main error is the invalid declaration and now the
downstream errors can be a bit different because the decl has been invalidated.
2016-07-06 22:06:50 -07:00
practicalswift
6db81f0ab9 Add 💥 (😢 → 58, 😀 → 5099) in swift::TypeChecker::checkInheritanceClause(…)
Add test case for crash triggered in `swift::TypeChecker::checkInheritanceClause(…)`.

Assertion failure:
```
swift: /path/to/swift/lib/AST/ArchetypeBuilder.cpp:2109: static swift::Type swift::ArchetypeBuilder::mapTypeOutOfContext(swift::ModuleDecl *, swift::GenericParamList *, swift::Type): Assertion `!type->hasArchetype() && "not fully substituted"' failed.
```

<details>
<summary>Stack trace:</summary>
```
swift: /path/to/swift/lib/AST/ArchetypeBuilder.cpp:2109: static swift::Type swift::ArchetypeBuilder::mapTypeOutOfContext(swift::ModuleDecl *, swift::GenericParamList *, swift::Type): Assertion `!type->hasArchetype() && "not fully substituted"' failed.
9  swift           0x0000000000eabaef swift::TypeChecker::checkInheritanceClause(swift::Decl*, swift::GenericTypeResolver*) + 5279
13 swift           0x0000000000eb2686 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 150
14 swift           0x0000000000ed486a swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) + 1162
15 swift           0x0000000000c616a9 swift::CompilerInstance::performSema() + 3289
17 swift           0x00000000007d8419 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2857
18 swift           0x00000000007a4448 main + 2872
Stack dump:
0.	Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28347-swift-typechecker-checkinheritanceclause.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28347-swift-typechecker-checkinheritanceclause-4fd285.o
1.	While type-checking 'c' at validation-test/compiler_crashers/28347-swift-typechecker-checkinheritanceclause.swift:10:1
<unknown>:0: error: unable to execute command: Aborted
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
```
</details>
2016-07-06 23:24:18 +02:00
practicalswift
e3ec26a0e4 Add 💥 (😢 → 57, 😀 → 5099) in swift::TypeBase::getDesugaredType(…)
Add test case for crash triggered in `swift::TypeBase::getDesugaredType(…)`.

<details>
<summary>Stack trace:</summary>
```
4  swift           0x0000000001120000 swift::TypeBase::getDesugaredType() + 32
6  swift           0x0000000000eb7f0b swift::TypeChecker::addImplicitConstructors(swift::NominalTypeDecl*) + 635
7  swift           0x0000000000eabd2e swift::TypeChecker::checkInheritanceClause(swift::Decl*, swift::GenericTypeResolver*) + 5854
8  swift           0x0000000000ead058 swift::TypeChecker::validateDecl(swift::ValueDecl*, bool) + 376
9  swift           0x000000000110b61b swift::DeclContext::lookupQualified(swift::Type, swift::DeclName, swift::NLOptions, swift::LazyResolver*, llvm::SmallVectorImpl<swift::ValueDecl*>&) const + 2667
10 swift           0x0000000001109ebb swift::UnqualifiedLookup::UnqualifiedLookup(swift::DeclName, swift::DeclContext*, swift::LazyResolver*, bool, swift::SourceLoc, bool, bool) + 2491
11 swift           0x0000000000eeea4b swift::TypeChecker::lookupUnqualified(swift::DeclContext*, swift::DeclName, swift::SourceLoc, swift::OptionSet<swift::NameLookupFlags, unsigned int>) + 187
14 swift           0x0000000000f1ff6e swift::TypeChecker::resolveIdentifierType(swift::DeclContext*, swift::IdentTypeRepr*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, bool, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 158
16 swift           0x0000000000f20ec4 swift::TypeChecker::resolveType(swift::TypeRepr*, swift::DeclContext*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 164
17 swift           0x0000000000f1fe60 swift::TypeChecker::validateType(swift::TypeLoc&, swift::DeclContext*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 192
18 swift           0x0000000000eaba5a swift::TypeChecker::checkInheritanceClause(swift::Decl*, swift::GenericTypeResolver*) + 5130
19 swift           0x0000000000ead058 swift::TypeChecker::validateDecl(swift::ValueDecl*, bool) + 376
20 swift           0x000000000110b61b swift::DeclContext::lookupQualified(swift::Type, swift::DeclName, swift::NLOptions, swift::LazyResolver*, llvm::SmallVectorImpl<swift::ValueDecl*>&) const + 2667
21 swift           0x0000000001109ebb swift::UnqualifiedLookup::UnqualifiedLookup(swift::DeclName, swift::DeclContext*, swift::LazyResolver*, bool, swift::SourceLoc, bool, bool) + 2491
22 swift           0x0000000000eeea4b swift::TypeChecker::lookupUnqualified(swift::DeclContext*, swift::DeclName, swift::SourceLoc, swift::OptionSet<swift::NameLookupFlags, unsigned int>) + 187
25 swift           0x0000000000f1ff6e swift::TypeChecker::resolveIdentifierType(swift::DeclContext*, swift::IdentTypeRepr*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, bool, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 158
27 swift           0x0000000000f20ec4 swift::TypeChecker::resolveType(swift::TypeRepr*, swift::DeclContext*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 164
28 swift           0x0000000000f1fe60 swift::TypeChecker::validateType(swift::TypeLoc&, swift::DeclContext*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 192
29 swift           0x0000000000eaba5a swift::TypeChecker::checkInheritanceClause(swift::Decl*, swift::GenericTypeResolver*) + 5130
30 swift           0x0000000000eea415 swift::TypeChecker::checkGenericParamList(swift::ArchetypeBuilder*, swift::GenericParamList*, swift::GenericSignature*, bool, swift::GenericTypeResolver*) + 389
31 swift           0x0000000000eebc77 swift::TypeChecker::validateGenericSignature(swift::GenericParamList*, swift::DeclContext*, swift::GenericSignature*, std::function<bool (swift::ArchetypeBuilder&)>, bool&) + 135
32 swift           0x0000000000eec7df swift::TypeChecker::validateGenericTypeSignature(swift::GenericTypeDecl*) + 111
33 swift           0x0000000000ead04b swift::TypeChecker::validateDecl(swift::ValueDecl*, bool) + 363
38 swift           0x0000000000eb2686 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 150
39 swift           0x0000000000ed47e2 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) + 1026
40 swift           0x0000000000c616a9 swift::CompilerInstance::performSema() + 3289
42 swift           0x00000000007d8419 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2857
43 swift           0x00000000007a4448 main + 2872
Stack dump:
0.	Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28346-swift-typebase-getdesugaredtype.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28346-swift-typebase-getdesugaredtype-cd880b.o
1.	While type-checking 'A' at validation-test/compiler_crashers/28346-swift-typebase-getdesugaredtype.swift:9:1
2.	While resolving type A at [validation-test/compiler_crashers/28346-swift-typebase-getdesugaredtype.swift:9:21 - line:9:21] RangeText="A"
3.	While resolving type B at [validation-test/compiler_crashers/28346-swift-typebase-getdesugaredtype.swift:11:9 - line:11:9] RangeText="B"
<unknown>:0: error: unable to execute command: Segmentation fault
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
```
</details>
2016-07-06 17:44:56 +02:00
practicalswift
7006cf963e [swiftc] Add 💥 case (😢 → 56, 😀 → 5099) triggered in swift::IterativeTypeChecker::processTypeCheckSuperclass(…)
Add crash case with stack trace:

```
swift: /path/to/swift/lib/AST/Decl.cpp:4773: void swift::ClassDecl::setSuperclass(swift::Type): Assertion `(!superclass || !superclass->hasArchetype()) && "superclass must be interface type"' failed.
9  swift           0x0000000000fe609b swift::IterativeTypeChecker::processTypeCheckSuperclass(swift::ClassDecl*, llvm::function_ref<bool (swift::TypeCheckRequest)>) + 235
10 swift           0x0000000000fbdf4d swift::IterativeTypeChecker::satisfy(swift::TypeCheckRequest) + 493
11 swift           0x0000000000ea9cc0 swift::TypeChecker::resolveSuperclass(swift::ClassDecl*) + 64
12 swift           0x00000000011307b9 swift::ConformanceLookupTable::updateLookupTable(swift::NominalTypeDecl*, swift::ConformanceLookupTable::ConformanceStage, swift::LazyResolver*) + 217
13 swift           0x0000000001134042 swift::ConformanceLookupTable::lookupConformance(swift::ModuleDecl*, swift::NominalTypeDecl*, swift::ProtocolDecl*, swift::LazyResolver*, llvm::SmallVectorImpl<swift::ProtocolConformance*>&) + 50
14 swift           0x00000000010facbf swift::ModuleDecl::lookupConformance(swift::Type, swift::ProtocolDecl*, swift::LazyResolver*) + 1103
15 swift           0x0000000000ef80aa swift::TypeChecker::conformsToProtocol(swift::Type, swift::ProtocolDecl*, swift::DeclContext*, swift::OptionSet<swift::ConformanceCheckFlags, unsigned int>, swift::ProtocolConformance**, swift::SourceLoc) + 106
16 swift           0x0000000000f1e14d swift::TypeChecker::resolveTypeInContext(swift::TypeDecl*, swift::DeclContext*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, bool, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 1309
20 swift           0x0000000000f1f68e swift::TypeChecker::resolveIdentifierType(swift::DeclContext*, swift::IdentTypeRepr*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, bool, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 158
22 swift           0x0000000000f205e4 swift::TypeChecker::resolveType(swift::TypeRepr*, swift::DeclContext*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 164
23 swift           0x0000000000f1f580 swift::TypeChecker::validateType(swift::TypeLoc&, swift::DeclContext*, swift::OptionSet<swift::TypeResolutionFlags, unsigned int>, swift::GenericTypeResolver*, llvm::function_ref<bool (swift::TypeCheckRequest)>*) + 192
24 swift           0x0000000000ee9e82 swift::TypeChecker::checkGenericParamList(swift::ArchetypeBuilder*, swift::GenericParamList*, swift::GenericSignature*, bool, swift::GenericTypeResolver*) + 722
25 swift           0x0000000000eeb577 swift::TypeChecker::validateGenericSignature(swift::GenericParamList*, swift::DeclContext*, swift::GenericSignature*, std::function<bool (swift::ArchetypeBuilder&)>, bool&) + 135
26 swift           0x0000000000eec0df swift::TypeChecker::validateGenericTypeSignature(swift::GenericTypeDecl*) + 111
27 swift           0x0000000000eac86b swift::TypeChecker::validateDecl(swift::ValueDecl*, bool) + 363
35 swift           0x0000000000eb1ef6 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 150
36 swift           0x0000000000ed4102 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) + 1026
37 swift           0x0000000000c61489 swift::CompilerInstance::performSema() + 3289
39 swift           0x00000000007d82c9 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2857
40 swift           0x00000000007a4308 main + 2872
Stack dump:
0.	Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28345-swift-iterativetypechecker-processtypechecksuperclass.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28345-swift-iterativetypechecker-processtypechecksuperclass-a5f844.o
1.	While type-checking 'A' at validation-test/compiler_crashers/28345-swift-iterativetypechecker-processtypechecksuperclass.swift:10:1
2.	While resolving type B at [validation-test/compiler_crashers/28345-swift-iterativetypechecker-processtypechecksuperclass.swift:10:57 - line:10:57] RangeText="B"
<unknown>:0: error: unable to execute command: Aborted
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
```
2016-07-05 20:21:35 +02:00
practicalswift
d502529fe7 [swiftc] Add 💥 case (😢 → 55, 😀 → 5099) triggered in swift::Type::transform(…)
Add crash case with stack trace:

```
swift: /path/to/swift/lib/AST/ArchetypeBuilder.cpp:2049: auto swift::ArchetypeBuilder::mapTypeIntoContext(Module *, swift::GenericParamList *, swift::Type, swift::LazyResolver *)::(anonymous class)::operator()(swift::Type) const: Assertion `genericParamsDepth >= depth' failed.
9  swift           0x0000000001123b74 swift::Type::transform(llvm::function_ref<swift::Type (swift::Type)>) const + 36
10 swift           0x0000000001123e10 swift::Type::transform(llvm::function_ref<swift::Type (swift::Type)>) const + 704
11 swift           0x0000000000fefeeb swift::ArchetypeBuilder::mapTypeIntoContext(swift::ModuleDecl*, swift::GenericParamList*, swift::Type, swift::LazyResolver*) + 155
12 swift           0x0000000000f322e7 swift::createDesignatedInitOverride(swift::TypeChecker&, swift::ClassDecl*, swift::ConstructorDecl*, swift::DesignatedInitKind) + 119
13 swift           0x0000000000eb8173 swift::TypeChecker::addImplicitConstructors(swift::NominalTypeDecl*) + 3187
18 swift           0x0000000000eb1ef6 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 150
21 swift           0x0000000000f182ea swift::TypeChecker::typeCheckFunctionBodyUntil(swift::FuncDecl*, swift::SourceLoc) + 346
22 swift           0x0000000000f1814e swift::TypeChecker::typeCheckAbstractFunctionBodyUntil(swift::AbstractFunctionDecl*, swift::SourceLoc) + 46
23 swift           0x0000000000f18d13 swift::TypeChecker::typeCheckAbstractFunctionBody(swift::AbstractFunctionDecl*) + 179
25 swift           0x0000000000ed4201 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) + 1281
26 swift           0x0000000000c61489 swift::CompilerInstance::performSema() + 3289
28 swift           0x00000000007d82c9 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2857
29 swift           0x00000000007a4308 main + 2872
Stack dump:
0.	Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28344-swift-type-transform.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28344-swift-type-transform-510b91.o
1.	While type-checking 'a' at validation-test/compiler_crashers/28344-swift-type-transform.swift:10:1
2.	While type-checking 'A' at validation-test/compiler_crashers/28344-swift-type-transform.swift:10:8
<unknown>:0: error: unable to execute command: Aborted
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
```
2016-07-05 10:45:32 +02:00
Slava Pestov
5a902935e8 Sema: Explicitly set interface type on all AbstractFunctionDecls
Previously getInterfaceType() would punt to getType() if no
interface type was set. This patch changes getInterfaceType()
to assert if no interface type is set, and updates various
places to set the interface type explicitly.

This brings us a step closer to removing PolymorphicFunctionType.
2016-07-05 00:24:28 -07:00
practicalswift
3c3e87268d [swiftc] Add 💥 case (😢 → 55, 😀 → 5098) triggered in swift::GenericFunctionType::get(…)
Add crash case with stack trace:

```
swift: /path/to/swift/lib/AST/ASTContext.cpp:3041: static swift::GenericFunctionType *swift::GenericFunctionType::get(swift::GenericSignature *, swift::Type, swift::Type, const swift::AnyFunctionType::ExtInfo &): Assertion `!input->hasTypeVariable() && !output->hasTypeVariable()' failed.
8  swift           0x00000000010064db swift::GenericFunctionType::get(swift::GenericSignature*, swift::Type, swift::Type, swift::AnyFunctionType::ExtInfo const&) + 603
9  swift           0x00000000011251e3 swift::Type::transform(llvm::function_ref<swift::Type (swift::Type)>) const + 5747
10 swift           0x0000000001125be8 swift::TypeBase::getTypeOfMember(swift::ModuleDecl*, swift::Type, swift::DeclContext const*) + 136
14 swift           0x0000000000f62209 swift::constraints::ConstraintSystem::diagnoseFailureForExpr(swift::Expr*) + 105
15 swift           0x0000000000f67b8e swift::constraints::ConstraintSystem::salvage(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::Expr*) + 3998
16 swift           0x0000000000e99d32 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>) + 850
17 swift           0x0000000000ea0492 swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*) + 610
19 swift           0x0000000000f64652 swift::constraints::ConstraintSystem::diagnoseFailureForExpr(swift::Expr*) + 9394
20 swift           0x0000000000f67b8e swift::constraints::ConstraintSystem::salvage(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::Expr*) + 3998
21 swift           0x0000000000e99d32 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>) + 850
22 swift           0x0000000000ea0492 swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*) + 610
23 swift           0x0000000000ea1647 swift::TypeChecker::typeCheckBinding(swift::Pattern*&, swift::Expr*&, swift::DeclContext*) + 343
24 swift           0x0000000000ea185b swift::TypeChecker::typeCheckPatternBinding(swift::PatternBindingDecl*, unsigned int) + 267
27 swift           0x0000000000eb1ef6 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 150
30 swift           0x0000000000f19664 swift::TypeChecker::typeCheckClosureBody(swift::ClosureExpr*) + 244
31 swift           0x0000000000f4599c swift::constraints::ConstraintSystem::applySolution(swift::constraints::Solution&, swift::Expr*, swift::Type, bool, bool, bool) + 876
32 swift           0x0000000000ea0531 swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*) + 769
35 swift           0x0000000000f182ea swift::TypeChecker::typeCheckFunctionBodyUntil(swift::FuncDecl*, swift::SourceLoc) + 346
36 swift           0x0000000000f1814e swift::TypeChecker::typeCheckAbstractFunctionBodyUntil(swift::AbstractFunctionDecl*, swift::SourceLoc) + 46
37 swift           0x0000000000f18d13 swift::TypeChecker::typeCheckAbstractFunctionBody(swift::AbstractFunctionDecl*) + 179
39 swift           0x0000000000ed4201 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) + 1281
40 swift           0x0000000000c61489 swift::CompilerInstance::performSema() + 3289
42 swift           0x00000000007d82c9 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2857
43 swift           0x00000000007a4308 main + 2872
Stack dump:
0.	Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28343-swift-genericfunctiontype-get.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28343-swift-genericfunctiontype-get-849f66.o
1.	While type-checking getter for a at validation-test/compiler_crashers/28343-swift-genericfunctiontype-get.swift:13:6
2.	While type-checking expression at [validation-test/compiler_crashers/28343-swift-genericfunctiontype-get.swift:13:7 - line:14:8] RangeText="{
3.	While type-checking declaration 0x58b5180 at validation-test/compiler_crashers/28343-swift-genericfunctiontype-get.swift:14:1
4.	While type-checking expression at [validation-test/compiler_crashers/28343-swift-genericfunctiontype-get.swift:14:7 - line:14:8] RangeText="p{"
5.	While type-checking expression at [validation-test/compiler_crashers/28343-swift-genericfunctiontype-get.swift:14:7 - line:14:8] RangeText="p{"
<unknown>:0: error: unable to execute command: Aborted
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
```
2016-07-04 23:10:57 +02:00
practicalswift
ad578e89c1 Flag "-emit-ir" is needed to trigger crash. 2016-07-04 22:53:15 +02:00
practicalswift
bc208f5ef1 [swiftc] Add 💥 case (😢 → 56, 😀 → 5096) triggered in swift::irgen::IRGenModule::emitSILFunction(…)
Add crash case with stack trace:

```
swift: /path/to/swift/lib/IRGen/GenType.cpp:84: swift::irgen::Address swift::irgen::TypeInfo::getAddressForPointer(llvm::Value *) const: Assertion `ptr->getType()->getPointerElementType() == StorageType' failed.
11 swift           0x00000000008af5e9 swift::irgen::IRGenModule::emitSILFunction(swift::SILFunction*) + 1241
12 swift           0x000000000080d028 swift::irgen::IRGenerator::emitGlobalTopLevel() + 408
14 swift           0x00000000007e6954 swift::performIRGeneration(swift::IRGenOptions&, swift::SourceFile&, swift::SILModule*, llvm::StringRef, llvm::LLVMContext&, unsigned int) + 68
16 swift           0x00000000007d82c9 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2857
17 swift           0x00000000007a4308 main + 2872
Stack dump:
0.	Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28342-getpointerelementtype-is-not-storagetype.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28342-getpointerelementtype-is-not-storagetype-7b6cf1.o
1.	While emitting IR SIL function @_TTWV4main1HS_1ES_FS1_1guRd__S_1Awx1Fzwd__1BrfGVS_1Cqd___T_ for 'g' at validation-test/compiler_crashers/28342-getpointerelementtype-is-not-storagetype.swift:22:5
<unknown>:0: error: unable to execute command: Aborted
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
```
2016-07-04 22:41:11 +02:00
swift-ci
5ca61f69fb Merge pull request #3331 from gregomni/getDeclaredType-cleanup 2016-07-03 20:03:31 -07:00