From 272638a30cf8b5a3d368201ab2a7fadd8c4548b3 Mon Sep 17 00:00:00 2001 From: Hamish Knight Date: Wed, 19 Nov 2025 09:07:23 +0000 Subject: [PATCH] [test] Add some more known crashers --- .../crashers/ReferenceStorageType-get-364574.swift | 4 ++++ ...rementMachine-getReducedTypeParameter-d837da.swift | 10 ++++++++++ .../AssociatedTypeInference-solve-c851da.swift | 6 ++++++ .../KeyPathExpr-getKeyPathType-a8fc68.swift | 5 +++++ .../LifetimeChecker-getLivenessAtInst-b7fa36.swift | 11 +++++++++++ .../formatDiagnosticArgument-49897c.swift | 11 +++++++++++ .../compiler_crashers/matchCallArguments-147bbd.swift | 5 +++++ 7 files changed, 52 insertions(+) create mode 100644 validation-test/IDE/crashers/ReferenceStorageType-get-364574.swift create mode 100644 validation-test/IDE/crashers/RequirementMachine-getReducedTypeParameter-d837da.swift create mode 100644 validation-test/compiler_crashers/AssociatedTypeInference-solve-c851da.swift create mode 100644 validation-test/compiler_crashers/KeyPathExpr-getKeyPathType-a8fc68.swift create mode 100644 validation-test/compiler_crashers/LifetimeChecker-getLivenessAtInst-b7fa36.swift create mode 100644 validation-test/compiler_crashers/formatDiagnosticArgument-49897c.swift create mode 100644 validation-test/compiler_crashers/matchCallArguments-147bbd.swift diff --git a/validation-test/IDE/crashers/ReferenceStorageType-get-364574.swift b/validation-test/IDE/crashers/ReferenceStorageType-get-364574.swift new file mode 100644 index 00000000000..38e1ff93cad --- /dev/null +++ b/validation-test/IDE/crashers/ReferenceStorageType-get-364574.swift @@ -0,0 +1,4 @@ +// {"kind":"complete","original":"186a3233","signature":"swift::ReferenceStorageType::get(swift::Type, swift::ReferenceOwnership, swift::ASTContext const&)","signatureAssert":"Assertion failed: (!T->hasTypeVariable()), function get"} +// RUN: not --crash %target-swift-ide-test -code-completion -batch-code-completion -skip-filecheck -code-completion-diagnostics -source-filename %s +struct a) const"} +// RUN: not --crash %target-swift-ide-test -code-completion -batch-code-completion -skip-filecheck -code-completion-diagnostics -source-filename %s +protocol a { + associatedtype b + struct c: a { + #^^# + } + d(b ) + #e { + d diff --git a/validation-test/compiler_crashers/AssociatedTypeInference-solve-c851da.swift b/validation-test/compiler_crashers/AssociatedTypeInference-solve-c851da.swift new file mode 100644 index 00000000000..dc22c071b4e --- /dev/null +++ b/validation-test/compiler_crashers/AssociatedTypeInference-solve-c851da.swift @@ -0,0 +1,6 @@ +// {"kind":"typecheck","original":"bc1e9cdf","signature":"(anonymous namespace)::AssociatedTypeInference::solve()","signatureAssert":"Assertion failed: (!hasTypeParameter() && \"already have an interface type\"), function mapTypeOutOfEnvironment"} +// RUN: not --crash %target-swift-frontend -typecheck %s +// REQUIRES: OS=macosx +import Distributed +distributed actor Distributed { +} diff --git a/validation-test/compiler_crashers/KeyPathExpr-getKeyPathType-a8fc68.swift b/validation-test/compiler_crashers/KeyPathExpr-getKeyPathType-a8fc68.swift new file mode 100644 index 00000000000..e7662d021d6 --- /dev/null +++ b/validation-test/compiler_crashers/KeyPathExpr-getKeyPathType-a8fc68.swift @@ -0,0 +1,5 @@ +// {"kind":"typecheck","original":"7048f9d7","signature":"swift::KeyPathExpr::getKeyPathType() const","signatureAssert":"Assertion failed: (isa(Val) && \"cast() argument of incompatible type!\"), function cast"} +// RUN: not --crash %target-swift-frontend -typecheck %s +{ + convenience #a(\array) +} diff --git a/validation-test/compiler_crashers/LifetimeChecker-getLivenessAtInst-b7fa36.swift b/validation-test/compiler_crashers/LifetimeChecker-getLivenessAtInst-b7fa36.swift new file mode 100644 index 00000000000..ea93f2a8066 --- /dev/null +++ b/validation-test/compiler_crashers/LifetimeChecker-getLivenessAtInst-b7fa36.swift @@ -0,0 +1,11 @@ +// {"kind":"emit-sil","original":"96451f18","signature":"(anonymous namespace)::LifetimeChecker::getLivenessAtInst(swift::SILInstruction*, unsigned int, unsigned int)","signatureAssert":"Assertion failed: (E <= size() && \"Attempted to set out-of-bounds range!\"), function set"} +// RUN: not --crash %target-swift-frontend -emit-sil %s +struct a { + let c: String + let d: b +} +extension a where b == Void { + init() { + d <= () + } +} diff --git a/validation-test/compiler_crashers/formatDiagnosticArgument-49897c.swift b/validation-test/compiler_crashers/formatDiagnosticArgument-49897c.swift new file mode 100644 index 00000000000..a69a13bfc5e --- /dev/null +++ b/validation-test/compiler_crashers/formatDiagnosticArgument-49897c.swift @@ -0,0 +1,11 @@ +// {"kind":"typecheck","original":"30ab265f","signature":"formatDiagnosticArgument(llvm::StringRef, llvm::StringRef, llvm::ArrayRef, unsigned int, swift::DiagnosticFormatOptions, llvm::raw_ostream&)","signatureAssert":"Assertion failed: ((!ModifierArguments.empty() || foundPipe) && \"Index beyond bounds in %select modifier\"), function formatSelectionArgument"} +// RUN: not --crash %target-swift-frontend -typecheck %s +// REQUIRES: OS=macosx +// REQUIRES: objc_interop +import Foundation +@objc protocol a { + optional var name: String +} +extension NSObject: a { + var names = <#expression#> +} diff --git a/validation-test/compiler_crashers/matchCallArguments-147bbd.swift b/validation-test/compiler_crashers/matchCallArguments-147bbd.swift new file mode 100644 index 00000000000..a0c10d5ad65 --- /dev/null +++ b/validation-test/compiler_crashers/matchCallArguments-147bbd.swift @@ -0,0 +1,5 @@ +// {"kind":"typecheck","original":"6e824970","signature":"matchCallArguments(swift::constraints::ConstraintSystem&, swift::FunctionType*, swift::ArgumentList*, llvm::ArrayRef, llvm::ArrayRef, swift::constraints::ConstraintKind, swift::constraints::ConstraintLocatorBuilder, std::__1::optional, llvm::SmallVectorImpl>&)"} +// RUN: not --crash %target-swift-frontend -typecheck %s +{ + $1 +}($a: [])