From 8c6a1f8878352b855f8e6ed800b00b2a2e8575ea Mon Sep 17 00:00:00 2001 From: Hamish Knight Date: Wed, 20 Aug 2025 11:43:08 +0100 Subject: [PATCH 1/2] [test] Update a couple of crasher signatures --- validation-test/IDE/crashers/e8698acd627edfb.swift | 2 +- validation-test/compiler_crashers_2/a8c84d1122922f83.swift | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/validation-test/IDE/crashers/e8698acd627edfb.swift b/validation-test/IDE/crashers/e8698acd627edfb.swift index f183284574569..06b8998c8febe 100644 --- a/validation-test/IDE/crashers/e8698acd627edfb.swift +++ b/validation-test/IDE/crashers/e8698acd627edfb.swift @@ -1,3 +1,3 @@ -// {"kind":"complete","original":"bae855bf","signature":"swift::GenericSignatureRequest::diagnoseCycle(swift::DiagnosticEngine&) const","signatureAssert":"Assertion failed: (!ActiveDiagnostic && \"Already have an active diagnostic\"), function diagnose"} +// {"kind":"complete","original":"bae855bf","signature":"swift::GenericTypeParamDecl::getSourceRange() const","signatureAssert":"Assertion failed: (Start.isValid() == End.isValid() && \"Start and end should either both be valid or both be invalid!\"), function SourceRange"} // RUN: not --crash %target-swift-ide-test -code-completion -batch-code-completion -skip-filecheck -code-completion-diagnostics -source-filename %s class a { associatedtype b From 0c29284098e833d452223adafe4f032d4b43302f Mon Sep 17 00:00:00 2001 From: Hamish Knight Date: Wed, 20 Aug 2025 11:43:08 +0100 Subject: [PATCH 2/2] [test] Add some more known crashers --- .../IDE/crashers/4334b05c244e77cf.swift | 11 +++++++++++ .../IDE/crashers/55f0ac4dba91c84.swift | 9 +++++++++ .../IDE/crashers/c9b7522368139eb7.swift | 8 ++++++++ .../IDE/crashers/dc8881dce3e968b.swift | 4 ++++ .../IDE/crashers/dffa2c2577e3e11.swift | 5 +++++ .../compiler_crashers_2/28db756e678d736.swift | 11 +++++++++++ .../compiler_crashers_2/2a435f4c7a59cd72.swift | 10 ++++++++++ .../compiler_crashers_2/5b22e7353651698.swift | 9 +++++++++ .../compiler_crashers_2/699345a5431680.swift | 10 ++++++++++ .../compiler_crashers_2/75bcc84cc8b7789.swift | 5 +++++ .../compiler_crashers_2/be64bc4123212eee.swift | 9 +++++++++ .../d815492a6398a52.swift | 15 +++++++++++++++ 12 files changed, 106 insertions(+) create mode 100644 validation-test/IDE/crashers/4334b05c244e77cf.swift create mode 100644 validation-test/IDE/crashers/55f0ac4dba91c84.swift create mode 100644 validation-test/IDE/crashers/c9b7522368139eb7.swift create mode 100644 validation-test/IDE/crashers/dc8881dce3e968b.swift create mode 100644 validation-test/IDE/crashers/dffa2c2577e3e11.swift create mode 100644 validation-test/compiler_crashers_2/28db756e678d736.swift create mode 100644 validation-test/compiler_crashers_2/2a435f4c7a59cd72.swift create mode 100644 validation-test/compiler_crashers_2/5b22e7353651698.swift create mode 100644 validation-test/compiler_crashers_2/699345a5431680.swift create mode 100644 validation-test/compiler_crashers_2/75bcc84cc8b7789.swift create mode 100644 validation-test/compiler_crashers_2/be64bc4123212eee.swift create mode 100644 validation-test/compiler_crashers_2_fixed/d815492a6398a52.swift diff --git a/validation-test/IDE/crashers/4334b05c244e77cf.swift b/validation-test/IDE/crashers/4334b05c244e77cf.swift new file mode 100644 index 0000000000000..35e4d930ed518 --- /dev/null +++ b/validation-test/IDE/crashers/4334b05c244e77cf.swift @@ -0,0 +1,11 @@ +// {"kind":"complete","original":"1a6ddccd","signature":"getRequirementMachine"} +// RUN: not --crash %target-swift-ide-test -code-completion -batch-code-completion -skip-filecheck -code-completion-diagnostics -source-filename %s +protocol a { + associatedtype c: a + var b: c +} +protocol d: a where c == Never + extension Never: d + extension d { + public( #^^# + b: Never diff --git a/validation-test/IDE/crashers/55f0ac4dba91c84.swift b/validation-test/IDE/crashers/55f0ac4dba91c84.swift new file mode 100644 index 0000000000000..5cb1e3ea4d47e --- /dev/null +++ b/validation-test/IDE/crashers/55f0ac4dba91c84.swift @@ -0,0 +1,9 @@ +// {"kind":"complete","original":"df6ac250","signature":"bool llvm::function_ref::callback_fn(long, swift::constraints::Constraint*)","signatureAssert":"Assertion failed: (isa(Val) && \"cast() argument of incompatible type!\"), function cast"} +// RUN: not --crash %target-swift-ide-test -code-completion -batch-code-completion -skip-filecheck -code-completion-diagnostics -source-filename %s +struct a { +b func b() + #if { + b(<#expression#>) + }#^^# + #endif +} diff --git a/validation-test/IDE/crashers/c9b7522368139eb7.swift b/validation-test/IDE/crashers/c9b7522368139eb7.swift new file mode 100644 index 0000000000000..5ce57ee115ef7 --- /dev/null +++ b/validation-test/IDE/crashers/c9b7522368139eb7.swift @@ -0,0 +1,8 @@ +// {"kind":"complete","original":"ad5b343d","signature":"swift::InterfaceTypeRequest::cacheResult(swift::Type) const","signatureAssert":"Assertion failed: (!type->is() && \"Interface type must be materializable\"), function cacheResult"} +// RUN: not --crash %target-swift-ide-test -code-completion -batch-code-completion -skip-filecheck -code-completion-diagnostics -source-filename %s +[ + #^^# +].reduce?( + [:][0] { + $a, b in + }) diff --git a/validation-test/IDE/crashers/dc8881dce3e968b.swift b/validation-test/IDE/crashers/dc8881dce3e968b.swift new file mode 100644 index 0000000000000..983371128574c --- /dev/null +++ b/validation-test/IDE/crashers/dc8881dce3e968b.swift @@ -0,0 +1,4 @@ +// {"kind":"complete","original":"6384b7fc","signature":"swift::TypeChecker::typeCheckForCodeCompletion(swift::constraints::SyntacticElementTarget&, bool, llvm::function_ref)","signatureAssert":"Assertion failed: (fallback->E != expr), function typeCheckForCodeCompletion"} +// RUN: not --crash %target-swift-ide-test -code-completion -batch-code-completion -skip-filecheck -code-completion-diagnostics -source-filename %s +func a -> b +a > (c > a #^^# )' diff --git a/validation-test/IDE/crashers/dffa2c2577e3e11.swift b/validation-test/IDE/crashers/dffa2c2577e3e11.swift new file mode 100644 index 0000000000000..39bec6441535a --- /dev/null +++ b/validation-test/IDE/crashers/dffa2c2577e3e11.swift @@ -0,0 +1,5 @@ +// {"kind":"complete","original":"7f4bcc9e","signature":"swift::DeclContext::getDeclaredInterfaceType() const","signatureAssert":"Assertion failed: (detail::isPresent(Val) && \"dyn_cast on a non-existent value\"), function dyn_cast"} +// RUN: not --crash %target-swift-ide-test -code-completion -batch-code-completion -skip-filecheck -code-completion-diagnostics -source-filename %s +extension Sequence where a == b[ { + func c() -> #^^# +} diff --git a/validation-test/compiler_crashers_2/28db756e678d736.swift b/validation-test/compiler_crashers_2/28db756e678d736.swift new file mode 100644 index 0000000000000..79b6347902639 --- /dev/null +++ b/validation-test/compiler_crashers_2/28db756e678d736.swift @@ -0,0 +1,11 @@ +// {"kind":"emit-silgen","signature":"swift::Lowering::SILGenModule::useConformance(swift::ProtocolConformanceRef)"} +// RUN: not --crash %target-swift-frontend -emit-silgen %s +protocol a { +} +struct b { +} +extension [b] { + func d() { + first + } +} diff --git a/validation-test/compiler_crashers_2/2a435f4c7a59cd72.swift b/validation-test/compiler_crashers_2/2a435f4c7a59cd72.swift new file mode 100644 index 0000000000000..dabec35c339f8 --- /dev/null +++ b/validation-test/compiler_crashers_2/2a435f4c7a59cd72.swift @@ -0,0 +1,10 @@ +// {"kind":"typecheck","original":"b3234b81","signature":"swift::constraints::ConstraintSystem::recordImpliedResult(swift::Expr*, swift::constraints::ImpliedResultKind)","signatureAssert":"Assertion failed: (inserted && \"Duplicate implied result?\"), function recordImpliedResult"} +// RUN: not --crash %target-swift-frontend -typecheck %s +[ + switch 0 { + case .a( + if <#expression#> { + b + }): + } +] diff --git a/validation-test/compiler_crashers_2/5b22e7353651698.swift b/validation-test/compiler_crashers_2/5b22e7353651698.swift new file mode 100644 index 0000000000000..94a6caf1c03a0 --- /dev/null +++ b/validation-test/compiler_crashers_2/5b22e7353651698.swift @@ -0,0 +1,9 @@ +// {"kind":"typecheck","original":"6f23f24c","signature":"diagnoseUnintendedOptionalBehavior(swift::Expr const*, swift::DeclContext const*)::UnintendedOptionalBehaviorWalker::walkToExprPre(swift::Expr*)"} +// RUN: not --crash %target-swift-frontend -typecheck %s +{ + @<#type#> + #a { + &b + 0 as c + } +} diff --git a/validation-test/compiler_crashers_2/699345a5431680.swift b/validation-test/compiler_crashers_2/699345a5431680.swift new file mode 100644 index 0000000000000..2a327f0443766 --- /dev/null +++ b/validation-test/compiler_crashers_2/699345a5431680.swift @@ -0,0 +1,10 @@ +// {"kind":"typecheck","original":"96fa6e3e","signature":"swift::StorageImplInfoRequest::evaluate(swift::Evaluator&, swift::AbstractStorageDecl*) const","signatureAssert":"Assertion failed: (info.hasStorage() == storage->hasStorage() || storage->getASTContext().Diags.hadAnyError()), function evaluate"} +// RUN: not --crash %target-swift-frontend -typecheck %s +class a { + func b() { + override var c: Any { + didSet { + } + } + } +} diff --git a/validation-test/compiler_crashers_2/75bcc84cc8b7789.swift b/validation-test/compiler_crashers_2/75bcc84cc8b7789.swift new file mode 100644 index 0000000000000..f42947e9b5095 --- /dev/null +++ b/validation-test/compiler_crashers_2/75bcc84cc8b7789.swift @@ -0,0 +1,5 @@ +// {"kind":"typecheck","original":"7e87f396","signature":"swift::Mangle::ASTMangler::appendOpaqueTypeArchetype(swift::ArchetypeType*, swift::OpaqueTypeDecl*, swift::SubstitutionMap, swift::GenericSignature, swift::ValueDecl const*)","signatureAssert":"Assertion failed: (subs.isIdentity()), function appendOpaqueTypeArchetype"} +// RUN: not --crash %target-swift-frontend -typecheck %s +protocol a + func b -> some a where c += diff --git a/validation-test/compiler_crashers_2/be64bc4123212eee.swift b/validation-test/compiler_crashers_2/be64bc4123212eee.swift new file mode 100644 index 0000000000000..57deb1849cd6b --- /dev/null +++ b/validation-test/compiler_crashers_2/be64bc4123212eee.swift @@ -0,0 +1,9 @@ +// {"kind":"typecheck","signature":"swift::constraints::RequirementFailure::RequirementFailure(swift::constraints::Solution const&, swift::Type, swift::Type, swift::constraints::ConstraintLocator*)","signatureAssert":"Assertion failed: (AffectedDecl), function RequirementFailure"} +// RUN: not --crash %target-swift-frontend -typecheck %s +protocol a + struct b = + } + b +.d diff --git a/validation-test/compiler_crashers_2_fixed/d815492a6398a52.swift b/validation-test/compiler_crashers_2_fixed/d815492a6398a52.swift new file mode 100644 index 0000000000000..babb435e2fe5e --- /dev/null +++ b/validation-test/compiler_crashers_2_fixed/d815492a6398a52.swift @@ -0,0 +1,15 @@ +// {"kind":"typecheck","original":"cc407c71","signature":"(anonymous namespace)::TypeSubstituter::transformOpaqueTypeArchetypeType(swift::OpaqueTypeArchetypeType*, swift::TypePosition)","stackOverflow":true} +// RUN: not %target-swift-frontend -typecheck %s +protocol a + @resultBuilder struct b { + static buildBlock(repeat each c) -> d + } + struct d