Skip to content

[SR-8475] Code completion: Assertion failed: (hasInterfaceType() && "No interface type was set") #50996

@nathawes

Description

@nathawes
Previous ID SR-8475
Radar rdar://problem/43057057
Original Reporter @nathawes
Type Bug
Status Resolved
Resolution Done
Additional Detail from JIRA
Votes 0
Component/s CodeCompletion
Labels Bug, CompilerCrash
Assignee @rintaro
Priority Medium

md5: 537258eef533a2ab194e8e0287ede4b8

Issue Description:

import Foundation

class Decompressor {
  func decompress(_ data: Data, finish: Bool) throws -> Data {
    return try data.withUnsafeBytes { (bytes: UnsafePointer<#^COMPLETE^#UInt8>) -> Data in
      return try other(bytes: bytes, count: data.count, finish: finish)
    }
  }
  
  func other(bytes: UnsafePointer<UInt8>, count: Int, finish: Bool) throws -> Data {
    fatalError()
  }
}

{code:title=$ swift-ide-test -code-completion -code-completion-token=COMPLETE -source-filename /tmp/test.swift}
found code completion token COMPLETE at offset 163
found code completion token COMPLETE at offset 163
Assertion failed: (hasInterfaceType() && "No interface type was set"), function getInterfaceType, file /Users/nathanhawes/workspace/open-swift-source-compat-suite-master/swift/lib/AST/Decl.cpp, line 2137.
0 swift-ide-test 0x000000011188e8b8 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 40
1 swift-ide-test 0x000000011188d826 llvm::sys::RunSignalHandlers() + 198
2 swift-ide-test 0x000000011188eed2 SignalHandler(int) + 258
3 libsystem_platform.dylib 0x00007fff7dd65f5a _sigtramp + 26
4 swift-ide-test 0x000000010e597d72 swift::constraints::ConstraintSystem::performMemberLookup(swift::constraints::ConstraintKind, swift::DeclName, swift::Type, swift::FunctionRefKind, swift::constraints::ConstraintLocator*, bool) + 3554
5 libsystem_c.dylib 0x00007fff7db0f1ae abort + 127
6 libsystem_c.dylib 0x00007fff7dad71ac basename_r + 0
7 swift-ide-test 0x000000010e8fc3a2 swift::ValueDecl::getInterfaceType() const + 50
8 swift-ide-test 0x000000010e5756a9 swift::ASTVisitor<(anonymous namespace)::ConstraintGenerator, swift::Type, void, void, void, void, void>::visit(swift::Expr*) + 8601
9 swift-ide-test 0x000000010e57c2ef (anonymous namespace)::ConstraintWalker::walkToExprPost(swift::Expr*) + 415
10 swift-ide-test 0x000000010e8d581e swift::ASTVisitor<(anonymous namespace)::Traversal, swift::Expr*, swift::Stmt*, bool, swift::Pattern*, bool, void>::visit(swift::Expr*) + 3262
11 swift-ide-test 0x000000010e8d6d7f (anonymous namespace)::Traversal::visitApplyExpr(swift::ApplyExpr*) + 207
12 swift-ide-test 0x000000010e8d4be6 swift::ASTVisitor<(anonymous namespace)::Traversal, swift::Expr*, swift::Stmt*, bool, swift::Pattern*, bool, void>::visit(swift::Expr*) + 134
13 swift-ide-test 0x000000010e8d64e8 swift::ASTVisitor<(anonymous namespace)::Traversal, swift::Expr*, swift::Stmt*, bool, swift::Pattern*, bool, void>::visit(swift::Expr*) + 6536
14 swift-ide-test 0x000000010e8d4be6 swift::ASTVisitor<(anonymous namespace)::Traversal, swift::Expr*, swift::Stmt*, bool, swift::Pattern*, bool, void>::visit(swift::Expr*) + 134
15 swift-ide-test 0x000000010e8d6d7f (anonymous namespace)::Traversal::visitApplyExpr(swift::ApplyExpr*) + 207
16 swift-ide-test 0x000000010e8d4be6 swift::ASTVisitor<(anonymous namespace)::Traversal, swift::Expr*, swift::Stmt*, bool, swift::Pattern*, bool, void>::visit(swift::Expr*) + 134
17 swift-ide-test 0x000000010e8d4504 swift::Expr::walk(swift::ASTWalker&) + 84
18 swift-ide-test 0x000000010e572119 swift::constraints::ConstraintSystem::generateConstraints(swift::Expr*) + 409
19 swift-ide-test 0x000000010e5abae7 swift::constraints::ConstraintSystem::solveImpl(swift::Expr*&, swift::Type, swift::ExprTypeCheckListener*, llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::FreeTypeVariableBinding) + 471
20 swift-ide-test 0x000000010e5ab68f swift::constraints::ConstraintSystem::solve(swift::Expr*&, swift::Type, swift::ExprTypeCheckListener*, llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::FreeTypeVariableBinding) + 31
21 swift-ide-test 0x000000010e6453dd swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*, swift::constraints::ConstraintSystem*) + 845
22 swift-ide-test 0x000000010e6d5c6c swift::ASTVisitor<(anonymous namespace)::StmtChecker, void, swift::Stmt*, void, void, void, void>::visit(swift::Stmt*) + 8764
23 swift-ide-test 0x000000010e6d3b7c swift::ASTVisitor<(anonymous namespace)::StmtChecker, void, swift::Stmt*, void, void, void, void>::visit(swift::Stmt*) + 332
24 swift-ide-test 0x000000010e6d2cf5 (anonymous namespace)::StmtChecker::typeCheckBody(swift::BraceStmt*&) + 85
25 swift-ide-test 0x000000010e6d2140 swift::TypeChecker::typeCheckFunctionBodyUntil(swift::FuncDecl*, swift::SourceLoc) + 288
26 swift-ide-test 0x000000010e6f5c78 swift::typeCheckAbstractFunctionBodyUntil(swift::AbstractFunctionDecl*, swift::SourceLoc) + 1192
27 swift-ide-test 0x000000010e32171c (anonymous namespace)::CodeCompletionCallbacksImpl::typeCheckContext(swift::DeclContext*) + 188
28 swift-ide-test 0x000000010e31b732 (anonymous namespace)::CodeCompletionCallbacksImpl::doneParsing() + 2706
29 swift-ide-test 0x000000010e819e50 (anonymous namespace)::ParseDelayedFunctionBodies::walkToDeclPre(swift::Decl*) + 304
30 swift-ide-test 0x000000010e8d4abb (anonymous namespace)::Traversal::doIt(swift::Decl*) + 171
31 swift-ide-test 0x000000010e8d97cb (anonymous namespace)::Traversal::visitNominalTypeDecl(swift::NominalTypeDecl*) + 475
32 swift-ide-test 0x000000010e8d4ae8 (anonymous namespace)::Traversal::doIt(swift::Decl*) + 216
33 swift-ide-test 0x000000010e8d49fb swift::Decl::walk(swift::ASTWalker&) + 27
34 swift-ide-test 0x000000010e98d29a swift::SourceFile::walk(swift::ASTWalker&) + 170
35 swift-ide-test 0x000000010e98bbaf swift::ModuleDecl::walk(swift::ASTWalker&) + 95
36 swift-ide-test 0x000000010e812f57 swift::performDelayedParsing(swift::DeclContext*, swift::PersistentParserState&, swift::CodeCompletionCallbacksFactory*) + 215
37 swift-ide-test 0x000000010e302fd9 swift::CompilerInstance::parseAndCheckTypesUpTo(swift::CompilerInstance::ImplicitImports const&, swift::SourceFile::ASTStage_t) + 1081
38 swift-ide-test 0x000000010e302269 swift::CompilerInstance::performSemaUpTo(swift::SourceFile::ASTStage_t) + 505
39 swift-ide-test 0x000000010e287212 main + 27554
40 libdyld.dylib 0x00007fff7da63015 start + 1
Stack dump:
0. Program arguments: /Users/nathanhawes/workspace/open-swift-source-compat-suite-master/build/compat_macos/swift-macosx-x86_64/bin/swift-ide-test -code-completion -code-completion-token=COMPLETE -source-filename /tmp/test2.swift

  1. While walking into decl 'Decompressor' at /tmp/test2.swift:3:1
  2. While type-checking statement at [/tmp/test2.swift:4:62 - line:8:3] RangeText="{
    return try data.withUnsafeBytes { (bytes: UnsafePointer<UInt8>) -> Data in
    return try other(bytes: bytes, count: data.count, finish: finish)
    }
    }"
  3. While type-checking statement at [/tmp/test2.swift:5:5 - line:7:5] RangeText="return try data.withUnsafeBytes { (bytes: UnsafePointer<UInt8>) -> Data in
    return try other(bytes: bytes, count: data.count, finish: finish)
    }"
  4. While type-checking expression at [/tmp/test2.swift:5:12 - line:7:5] RangeText="try data.withUnsafeBytes { (bytes: UnsafePointer<UInt8>) -> Data in
    return try other(bytes: bytes, count: data.count, finish: finish)
    }"
    Abort trap: 6

Metadata

Metadata

Assignees

Labels

bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.code completionArea → source tooling: code completioncompilerThe Swift compiler itselfcrashBug: A crash, i.e., an abnormal termination of softwaresource toolingArea: IDE support, SourceKit, and other source tooling

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions