Skip to content

Commit 4a0a62c

Browse files
[swiftc] Add test case for crash triggered in swift::Expr::walk(swift::ASTWalker&)
Stack trace: ``` swift: /path/to/swift/lib/Sema/CSApply.cpp:2314: swift::Expr *(anonymous namespace)::ExprRewriter::applyMemberRefExpr(swift::Expr *, swift::Expr *, swift::SourceLoc, swift::DeclNameLoc, bool): Assertion `resultTy->hasUnresolvedType() && "Should have a selected member if we got a type"' failed. 13 swift 0x0000000000fdccbe swift::Expr::walk(swift::ASTWalker&) + 46 14 swift 0x0000000000ed1376 swift::constraints::ConstraintSystem::applySolution(swift::constraints::Solution&, swift::Expr*, swift::Type, bool, bool, bool) + 502 15 swift 0x0000000000e33eca swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::Type, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*) + 746 18 swift 0x0000000000eeb2c9 swift::constraints::ConstraintSystem::diagnoseFailureForExpr(swift::Expr*) + 105 19 swift 0x0000000000eefda0 swift::constraints::ConstraintSystem::salvage(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::Expr*) + 4064 20 swift 0x0000000000e2d973 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>) + 787 21 swift 0x0000000000e33e20 swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::Type, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*) + 576 22 swift 0x0000000000e35ad1 swift::TypeChecker::typeCheckCondition(swift::Expr*&, swift::DeclContext*) + 145 23 swift 0x0000000000e35c2b swift::TypeChecker::typeCheckStmtCondition(llvm::MutableArrayRef<swift::StmtConditionElement>&, swift::DeclContext*, swift::Diag<>) + 251 27 swift 0x0000000000ea468a swift::TypeChecker::typeCheckFunctionBodyUntil(swift::FuncDecl*, swift::SourceLoc) + 346 28 swift 0x0000000000ea44ee swift::TypeChecker::typeCheckAbstractFunctionBodyUntil(swift::AbstractFunctionDecl*, swift::SourceLoc) + 46 29 swift 0x0000000000ea5088 swift::TypeChecker::typeCheckAbstractFunctionBody(swift::AbstractFunctionDecl*) + 136 31 swift 0x0000000000e69624 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int) + 1300 32 swift 0x0000000000cbc58f swift::CompilerInstance::performSema() + 3087 34 swift 0x000000000078b54f frontend_main(llvm::ArrayRef<char const*>, char const*, void*) + 2495 35 swift 0x0000000000786015 main + 2837 Stack dump: 0. Program arguments: /path/to/swift/bin/swift -frontend -c -primary-file validation-test/compiler_crashers/28265-swift-expr-walk.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -module-name main -o /tmp/28265-swift-expr-walk-d333bf.o 1. While type-checking 'a' at validation-test/compiler_crashers/28265-swift-expr-walk.swift:10:9 2. While type-checking expression at [validation-test/compiler_crashers/28265-swift-expr-walk.swift:10:19 - line:10:29] RangeText="c == .h.c=a" 3. While type-checking expression at [validation-test/compiler_crashers/28265-swift-expr-walk.swift:10:19 - line:10:27] RangeText="c == .h.c" <unknown>:0: error: unable to execute command: Aborted <unknown>:0: error: compile command failed due to signal (use -v to see invocation) ```
1 parent 67c7758 commit 4a0a62c

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// This source file is part of the Swift.org open source project
2+
// Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
3+
// Licensed under Apache License v2.0 with Runtime Library Exception
4+
//
5+
// See http://swift.org/LICENSE.txt for license information
6+
// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
7+
8+
// RUN: not --crash %target-swift-frontend %s -parse
9+
// REQUIRES: asserts
10+
class c<func a{if c == .h.c=a{

0 commit comments

Comments
 (0)