Skip to content

Commit 5cbdcaf

Browse files
authored
Merge pull request #82834 from hamishknight/fuzzy
[test] Add some more known crashers
2 parents a073e66 + 5730eb2 commit 5cbdcaf

39 files changed

+227
-1
lines changed

tools/swift-ide-test/swift-ide-test.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -448,6 +448,10 @@ RandomSeed("random-seed", llvm::cl::value_desc("seed"),
448448
llvm::cl::cat(Category),
449449
llvm::cl::init(0));
450450

451+
static llvm::cl::opt<bool> SourceOrderCompletion(
452+
"source-order-completion",
453+
llvm::cl::desc("Perform batch completion in source order"),
454+
llvm::cl::cat(Category));
451455

452456
static llvm::cl::opt<std::string>
453457
CompletionOutputDir("completion-output-dir", llvm::cl::value_desc("path"),
@@ -1501,7 +1505,7 @@ static int doBatchCodeCompletion(const CompilerInvocation &InitInvok,
15011505
<< TargetTokName << "\"\n";
15021506
return 1;
15031507
}
1504-
} else {
1508+
} else if (!options::SourceOrderCompletion) {
15051509
// Shuffle tokens to detect order-dependent bugs.
15061510
if (CCTokens.empty()) {
15071511
llvm::errs()
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// {"kind":"complete","signature":"matchCallArgumentsImpl(llvm::SmallVectorImpl<swift::AnyFunctionType::Param>&, llvm::ArrayRef<swift::AnyFunctionType::Param>, swift::ParameterListInfo const&, std::__1::optional<unsigned int>, bool, swift::constraints::TrailingClosureMatching, swift::constraints::MatchCallArgumentListener&, llvm::SmallVectorImpl<llvm::SmallVector<unsigned int, 1u>>&)::$_5::operator()(unsigned int&, swift::Identifier, bool, bool) const"}
2+
// RUN: not --crash %target-swift-ide-test -code-completion --code-completion-token=COMPLETE -code-completion-diagnostics -source-filename %s
3+
struct a {
4+
@dynamicMemberLookup enum b {
5+
subscript <c>(dynamicMember d: KeyPath<a, c>) -> c {
6+
@dynamicMemberLookup class e {c { self[
7+
#^COMPLETE^#}
8+
subscript(dynamicMember d: KeyPath<b, c>) -> c
9+
}
10+
}
11+
}
12+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// {"kind":"complete","signature":"swift::IterableDeclContext::addMemberSilently(swift::Decl*, swift::Decl*, bool) const"}
2+
// RUN: not --crash %target-swift-ide-test -code-completion --code-completion-token=COMPLETE -code-completion-diagnostics -source-filename %s
3+
{
4+
class a {
5+
lazy b: = #^COMPLETE^#
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// {"kind":"complete","signature":"swift::ide::AfterPoundExprCompletion::sawSolutionImpl(swift::constraints::Solution const&)"}
2+
// RUN: not --crash %target-swift-ide-test -code-completion --code-completion-token=COMPLETE -code-completion-diagnostics -source-filename %s
3+
{##^COMPLETE^#
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// {"kind":"complete","signature":"(anonymous namespace)::getEquivalentDeclContextFromSourceFile(swift::DeclContext*, swift::SourceFile*)"}
2+
// RUN: not --crash %target-swift-ide-test -code-completion -batch-code-completion -skip-filecheck -code-completion-diagnostics -source-filename %s
3+
do { func a { #^^# #^b^#
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// {"kind":"complete","signature":"swift::ide::IDEInspectionInstance::performCachedOperationIfPossible(llvm::hash_code, llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>, swift::SearchPathOptions const&, llvm::MemoryBuffer*, unsigned int, swift::DiagnosticConsumer*, std::__1::shared_ptr<std::__1::atomic<bool>>, llvm::function_ref<void (swift::ide::CancellableResult<swift::ide::IDEInspectionInstanceResult>)>)","useSourceOrderCompletion":true}
2+
// RUN: not --crash %target-swift-ide-test -code-completion -batch-code-completion -skip-filecheck -code-completion-diagnostics -source-filename %s -source-order-completion
3+
#^^#
4+
#if a)#^COMPLETE3^#
5+
var
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// {"kind":"complete","signature":"void std::__1::__introsort<std::__1::_ClassicAlgPolicy, printCodeCompletionLookedupTypeNames(llvm::ArrayRef<swift::NullTerminatedStringRef>, llvm::raw_ostream&)::$_0&, swift::NullTerminatedStringRef*, false>(swift::NullTerminatedStringRef*, swift::NullTerminatedStringRef*, printCodeCompletionLookedupTypeNames(llvm::ArrayRef<swift::NullTerminatedStringRef>, llvm::raw_ostream&)::$_0&, std::__1::iterator_traits<swift::NullTerminatedStringRef*>::difference_type, bool)"}
2+
// RUN: not --crash %target-swift-ide-test -code-completion -batch-code-completion -skip-filecheck -code-completion-diagnostics -source-filename %s
3+
struct a<each b: Collection
4+
{
5+
c: (repeat each b.Index
6+
func == {
7+
repeat each d == (each c)#^^#
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// {"kind":"complete","signature":"swift::Mangle::ASTMangler::appendType(swift::Type, swift::GenericSignature, swift::ValueDecl const*)"}
2+
// RUN: not --crash %target-swift-ide-test -code-completion -batch-code-completion -skip-filecheck -code-completion-diagnostics -source-filename %s
3+
// REQUIRES: OS=macosx
4+
import Foundation switch Foundation { case #^^#
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// {"kind":"complete","signature":"swift::FragileFunctionKindRequest::evaluate(swift::Evaluator&, swift::DeclContext*) const"}
2+
// RUN: not --crash %target-swift-ide-test -code-completion --code-completion-token=COMPLETE -code-completion-diagnostics -source-filename %s
3+
enum a {
4+
case ( = {
5+
enum b :
6+
#^COMPLETE^#
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// {"kind":"complete","signature":"swift::irgen::IRGenModule::emitLazyObjCProtocolDefinition(swift::ProtocolDecl*)"}
2+
// Actual signature: matchCallArguments
3+
// RUN: not --crash %target-swift-ide-test -code-completion --code-completion-token=COMPLETE -code-completion-diagnostics -source-filename %s
4+
{ switch { case let c(#^COMPLETE^# b) a

0 commit comments

Comments
 (0)