Skip to content

[test] Add some known type-checker + parser crashers #81835

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 29, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions validation-test/compiler_crashers_2/109d1c5355f6eab4.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// {"signature":"swift::rewriting::RewriteContext::finishComputingRequirementSignatures(swift::ProtocolDecl const*)"}
// RUN: not --crash %target-swift-frontend -typecheck %s
protocol a : b where c == d<e> protocol f : g protocol g {
associatedtype 2 : a
}
struct d < e extension d
: f protocol h{associatedtype e associatedtype c : g} protocol b : h
7 changes: 7 additions & 0 deletions validation-test/compiler_crashers_2/1470917329979c9a.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// {"signature":"swift::PackExpansionType::PackExpansionType(swift::Type, swift::Type, swift::RecursiveTypeProperties, swift::ASTContext const*)"}
// RUN: not --crash %target-swift-frontend -typecheck %s
struct a < each b {
struct c {
d : (repeat(each b
func e {
c(&0
4 changes: 4 additions & 0 deletions validation-test/compiler_crashers_2/14b6ac8674b84f44.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// {"signature":"(anonymous namespace)::ABIDependencyEvaluator::computeABIDependenciesForModule(swift::ModuleDecl*)"}
// RUN: not --crash %target-swift-frontend -typecheck %s
switch {
case init
4 changes: 4 additions & 0 deletions validation-test/compiler_crashers_2/15659ed9344beff.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// {"signature":"getTypeForSymbolRange(swift::rewriting::Symbol const*, swift::rewriting::Symbol const*, llvm::ArrayRef<swift::GenericTypeParamType*>, swift::rewriting::PropertyMap const&)"}
// RUN: not --crash %target-swift-frontend -typecheck %s
// REQUIRES: OS=macosx
import Combine extension Publishers.Share{a <b , c where Upstream == Publishers.FlatMap <b, c>{func a <c where Upstream == Publishers.FlatMap <b, c>, c.Output ==
4 changes: 4 additions & 0 deletions validation-test/compiler_crashers_2/181de8a256df48e.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// {"signature":"swift::rewriting::RequirementMachine::verify(swift::rewriting::MutableTerm const&) const"}
// RUN: not --crash %target-swift-frontend -typecheck %s
protocol a {
typealias Index extension Collection where Self : a{b : Index} protocol a
4 changes: 4 additions & 0 deletions validation-test/compiler_crashers_2/2a41be58398eb21.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// {"signature":"swift::DeclContext::getASTContext() const"}
// RUN: not --crash %target-swift-frontend -typecheck %s
@a({ struct b }
var c
5 changes: 5 additions & 0 deletions validation-test/compiler_crashers_2/3077f0fa215b2f94.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// {"signature":"swift::Type llvm::function_ref<swift::Type (swift::SubstitutableType*)>::callback_fn<swift::TypeResolution::applyUnboundGenericArguments(swift::GenericTypeDecl*, swift::Type, swift::SourceLoc, llvm::ArrayRef<swift::Type>) const::$_0 const>(long, swift::SubstitutableType*)"}
// RUN: not --crash %target-swift-frontend -typecheck %s
protocol a extension a {
class b {
struct c < f struct d func e->c<d>
4 changes: 4 additions & 0 deletions validation-test/compiler_crashers_2/3badfb288fdf42f4.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// {"signature":"(anonymous namespace)::TypeSubstituter::transformDependentMemberType(swift::DependentMemberType*, swift::TypePosition)"}
// RUN: not --crash %target-swift-frontend -typecheck %s
// REQUIRES: OS=macosx
import Combine extension Publishers.Share where Upstream == {a <b , c > where Upstream == Publishers.FlatMap <b, c>
3 changes: 3 additions & 0 deletions validation-test/compiler_crashers_2/43bf2cb496111e.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// {"signature":"swift::Lexer::formEscapedIdentifierToken(char const*)"}
// RUN: not --crash %target-swift-frontend -typecheck %s
``
3 changes: 3 additions & 0 deletions validation-test/compiler_crashers_2/4414db6acd8120aa.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// {"signature":"swift::ast_scope::ASTScopeImpl::printRange(llvm::raw_ostream&) const"}
// RUN: not --crash %target-swift-frontend -typecheck %s
func a < >>
3 changes: 3 additions & 0 deletions validation-test/compiler_crashers_2/448bdb8b9df6dd2.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// {"signature":"swift::DeclRefTypeRepr::overwriteNameRef(swift::DeclNameRef)"}
// RUN: not --crash %target-swift-frontend -typecheck %s
switch { case init(
4 changes: 4 additions & 0 deletions validation-test/compiler_crashers_2/457eda8bf9011b6.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// {"signature":"swift::constraints::ConstraintSystem::setCapturedExpansions(swift::AnyFunctionRef, llvm::SmallVector<swift::PackExpansionExpr*, 1u>)"}
// RUN: not --crash %target-swift-frontend -typecheck %s
{
repeat a {
7 changes: 7 additions & 0 deletions validation-test/compiler_crashers_2/462ee2aa7dc23cf3.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// {"signature":"recordTypeWitness(swift::NormalProtocolConformance*, swift::AssociatedTypeDecl*, swift::Type, swift::TypeDecl*)"}
// RUN: not --crash %target-swift-frontend -typecheck %s
protocol a{associatedtype b} protocol c
: a{d(b)} protocol e{associatedtype f} extension e {
protocol g : e, c { associatedtype f : c associatedtype b }
struct h<i> : g {
typealias f = i
3 changes: 3 additions & 0 deletions validation-test/compiler_crashers_2/4c7611b7d95a1fb.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// {"signature":"(anonymous namespace)::ConstraintWalker::walkToExprPost(swift::Expr*)"}
// RUN: not --crash %target-swift-frontend -typecheck %s
\.+=
8 changes: 8 additions & 0 deletions validation-test/compiler_crashers_2/59b42964e169b6fa.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// {"signature":"swift::ProtocolConformanceRef::getProtocol() const"}
// RUN: not --crash %target-swift-frontend -typecheck %s
func a<each b {
enum c {
case struct var d: e struct e {
g: c }
f {
d.g == .struct
5 changes: 5 additions & 0 deletions validation-test/compiler_crashers_2/5ac7591881325acd.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// {"signature":"swift::constraints::Constraint::Constraint(swift::constraints::ConstraintKind, swift::Type, swift::Type, swift::constraints::ConstraintLocator*, llvm::SmallPtrSetImpl<swift::TypeVariableType*>&)"}
// RUN: not --crash %target-swift-frontend -typecheck %s
extension _UIntBuffer {
a {
struct b : OptionSet
3 changes: 3 additions & 0 deletions validation-test/compiler_crashers_2/5ca07be48f3dc630.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// {"signature":"swift::TuplePatternElt& llvm::SmallVectorTemplateBase<swift::TuplePatternElt, true>::growAndEmplaceBack<swift::Identifier, swift::SourceLoc, swift::Pattern*&>(swift::Identifier&&, swift::SourceLoc&&, swift::Pattern*&)"}
// RUN: not --crash %target-swift-frontend -typecheck %s
switch { case .a(&b
3 changes: 3 additions & 0 deletions validation-test/compiler_crashers_2/5ce9cd9830dc12a.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// {"signature":"swift::DeclAndTypePrinter::Implementation::visitVarDecl(swift::VarDecl*)"}
// RUN: not --crash %target-swift-frontend -typecheck %s
#init
4 changes: 4 additions & 0 deletions validation-test/compiler_crashers_2/698f276cef6d3418.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// {"signature":"swift::DefaultAndMaxAccessLevelRequest::cacheResult(std::__1::pair<swift::AccessLevel, swift::AccessLevel>) const"}
// RUN: not --crash %target-swift-frontend -typecheck %s
struct a < b extension a where b : c, d == a {
protocol c struct a
4 changes: 4 additions & 0 deletions validation-test/compiler_crashers_2/7315b4568a81e97d.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// {"signature":"swift::GenericSignature::verify(llvm::ArrayRef<swift::Requirement>) const"}
// RUN: not --crash %target-swift-frontend -typecheck %s
protocol a {
typealias b where Self : a protocol a
6 changes: 6 additions & 0 deletions validation-test/compiler_crashers_2/756ba8587e7eb26b.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// {"signature":"(anonymous namespace)::Verifier::verifyChecked(swift::Type)"}
// RUN: not --crash %target-swift-frontend -typecheck %s
class a < b {
d {
class e<c, b> : a struct f subscript<g>(h : e<f, g>) {
h.d base
3 changes: 3 additions & 0 deletions validation-test/compiler_crashers_2/78a5afee5d5b95.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// {"signature":"swift::Parser::parseStmtConditionElement(llvm::SmallVectorImpl<swift::StmtConditionElement>&, swift::Diag<>, swift::StmtKind, llvm::StringRef&)"}
// RUN: not --crash %target-swift-frontend -typecheck %s
func a: b[ if let
4 changes: 4 additions & 0 deletions validation-test/compiler_crashers_2/807f13dbbc4a604f.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// {"signature":"swift::AccessLevelRequest::cacheResult(swift::AccessLevel) const"}
// RUN: not --crash %target-swift-frontend -typecheck %s
class a < b extension a where c == d {
protocol d
7 changes: 7 additions & 0 deletions validation-test/compiler_crashers_2/9f30635127b9f25f.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// {"signature":"(anonymous namespace)::PreCheckTarget::walkToExprPre(swift::Expr*)"}
// RUN: not --crash %target-swift-frontend -typecheck %s
{
extension a {
b {
func c {
super
6 changes: 6 additions & 0 deletions validation-test/compiler_crashers_2/a7ee60c01ddf9624.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// {"signature":"(anonymous namespace)::LookupResultBuilder::add(swift::ValueDecl*, swift::DeclContext*, swift::ValueDecl*, swift::Type, bool)::'lambda'(swift::ValueDecl*)::operator()(swift::ValueDecl*) const"}
// RUN: not --crash %target-swift-frontend -typecheck %s
protocol a{b} protocol c : a protocol d : c extension d {
struct e : d {
f {
b
5 changes: 5 additions & 0 deletions validation-test/compiler_crashers_2/aea9b13219906649.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// {"signature":"checkRequirementsImpl(llvm::ArrayRef<swift::Requirement>, bool)"}
// RUN: not --crash %target-swift-frontend -typecheck %s
struct a < Element {
b {
class c : Collection { typealias Index = d subscript(e :
7 changes: 7 additions & 0 deletions validation-test/compiler_crashers_2/c25aed95f6f6d937.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// {"signature":"Assertion failed: (detail::isPresent(Val) && \"dyn_cast on a non-existent value\"), function dyn_cast, file Casting.h, line 662."}
// RUN: not --crash %target-swift-frontend -typecheck %s
{
extension {
a {
func b {
super
5 changes: 5 additions & 0 deletions validation-test/compiler_crashers_2/c9ec50236e69e012.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// {"signature":"(anonymous namespace)::Verifier::verifyParsed(swift::AbstractClosureExpr*)"}
// RUN: not --crash %target-swift-frontend -typecheck %s
func == {
switch {
case.a {
4 changes: 4 additions & 0 deletions validation-test/compiler_crashers_2/ccbe6b312cbec2.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// {"signature":"swift::constraints::MissingConformanceFailure::diagnoseTypeCannotConform(swift::Type, swift::Type) const"}
// RUN: not --crash %target-swift-frontend -typecheck %s
protocol a extension a {
b { func * (Self= {
3 changes: 3 additions & 0 deletions validation-test/compiler_crashers_2/d03a7ba9ca6274b0.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// {"signature":"swift::ParamSpecifierRequest::evaluate(swift::Evaluator&, swift::ParamDecl*) const"}
// RUN: not --crash %target-swift-frontend -typecheck %s
func a([0])
3 changes: 3 additions & 0 deletions validation-test/compiler_crashers_2/d885506018b583.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// {"signature":"swift::AvailabilityContext::Storage::get(swift::AvailabilityRange const&, bool, llvm::ArrayRef<swift::AvailabilityContext::DomainInfo>, swift::ASTContext const&)"}
// RUN: not --crash %target-swift-frontend -typecheck %s
protocol a extension a where b == Self{c : } typealias b : Sequence
4 changes: 4 additions & 0 deletions validation-test/compiler_crashers_2/f1419d3f3c2fe6b9.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// {"signature":"swift::QueryInterfaceTypeSubstitutions::operator()(swift::SubstitutableType*) const"}
// RUN: not --crash %target-swift-frontend -typecheck %s
extension Collection where Self : a {
struct Index protocol a
5 changes: 5 additions & 0 deletions validation-test/compiler_crashers_2/f6e25531c0e51b62.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// {"signature":"swift::constraints::RequirementFailure::RequirementFailure(swift::constraints::Solution const&, swift::Type, swift::Type, swift::constraints::ConstraintLocator*)"}
// RUN: not --crash %target-swift-frontend -typecheck %s
protocol a{associatedtype b} extension a where b == {
protocol c var d : c {
d
3 changes: 3 additions & 0 deletions validation-test/compiler_crashers_2/f9e59e692b1a6124.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// {"signature":"swift::constraints::Solution::getFunctionArgApplyInfo(swift::constraints::ConstraintLocator*) const"}
// RUN: not --crash %target-swift-frontend -typecheck %s
func a<b, each c>(d : repeat(b)->each c) { repeat d(e = f
3 changes: 3 additions & 0 deletions validation-test/compiler_crashers_2/fec3d092ae822aa6.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// {"signature":"swift::Parser::parseExprSequenceElement(swift::Diag<>, bool)"}
// RUN: not --crash %target-swift-frontend -typecheck %s
any a <
8 changes: 8 additions & 0 deletions validation-test/compiler_crashers_2/issue-81834.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// RUN: not --crash %target-swift-frontend -typecheck -library-level api %s
// REQUIRES: OS=macosx

// https://github.com/swiftlang/swift/issues/81834
public class C {
public subscript() -> Int {
get {
extension C {}