10000 Merge pull request #81835 from hamishknight/fuzzy · swiftlang/swift@dd1e0d7 · GitHub
[go: up one dir, main page]

Skip to content

Commit dd1e0d7

Browse files
authored
Merge pull request #81835 from hamishknight/fuzzy
[test] Add some known type-checker + parser crashers
2 parents e7e4c35 + b7d26fd commit dd1e0d7

36 files changed

+165
-0
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// {"signature":"swift::rewriting::RewriteContext::finishComputingRequirementSignatures(swift::ProtocolDecl const*)"}
2+
// RUN: not --crash %target-swift-frontend -typecheck %s
3+
protocol a : b where c == d<e> protocol f : g protocol g {
4+
associatedtype 2 : a
5+
}
6+
struct d < e extension d
7+
: f protocol h{associatedtype e associatedtype c : g} protocol b : h
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// {"signature":"swift::PackExpansionType::PackExpansionType(swift::Type, swift::Type, swift::RecursiveTypeProperties, swift::ASTContext const*)"}
2+
// RUN: not --crash %target-swift-frontend -typecheck %s
3+
struct a < each b {
4+
struct c {
5+
d : (repeat(each b
6+
func e {
7+
c(&0
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// {"signature":"(anonymous namespace)::ABIDependencyEvaluator::computeABIDependenciesForModule(swift::ModuleDecl*)"}
2+
// RUN: not --crash %target-swift-frontend -typecheck %s
3+
switch {
4+
case init
Lines changed: 4 additions & 0 deletions
57AE
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// {"signature":"getTypeForSymbolRange(swift::rewriting::Symbol const*, swift::rewriting::Symbol const*, llvm::ArrayRef<swift::GenericTypeParamType*>, swift::rewriting::PropertyMap const&)"}
2+
// RUN: not --crash %target-swift-frontend -typecheck %s
3+
// REQUIRES: OS=macosx
4+
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 ==
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// {"signature":"swift::rewriting::RequirementMachine::verify(swift::rewriting::MutableTerm const&) const"}
2+
// RUN: not --crash %target-swift-frontend -typecheck %s
3+
protocol a {
4+
typealias Index extension Collection where Self : a{b : Index} protocol a
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// {"signature":"swift::DeclContext::getASTContext() const"}
2+
// RUN: not --crash %target-swift-frontend -typecheck %s
3+
@a({ struct b }
4+
var c
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// {"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*)"}
2+
// RUN: not --crash %target-swift-frontend -typecheck %s
3+
protocol a extension a {
4+
class b {
5+
struct c < f struct d func e->c<d>
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// {"signature":"(anonymous namespace)::TypeSubstituter::transformDependentMemberType(swift::DependentMemberType*, swift::TypePosition)"}
2+
// RUN: not --crash %target-swift-frontend -typecheck %s
3+
// REQUIRES: OS=macosx
4+
import Combine extension Publishers.Share where Upstream == {a <b , c > where Upstream == Publishers.FlatMap <b, c>
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// {"signature":"swift::Lexer::formEscapedIdentifierToken(char const*)"}
2+
// RUN: not --crash %target-swift-frontend -typecheck %s
3+
``
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// {"signature":"swift::ast_scope::ASTScopeImpl::printRange(llvm::raw_ostream&) const"}
2+
// RUN: not --crash %target-swift-frontend -typecheck %s
3+
func a < >>
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// {"signature":"swift::DeclRefTypeRepr::overwriteNameRef(swift::DeclNameRef)"}
2+
// RUN: not --crash %target-swift-frontend -typecheck %s
3+
switch { case init(
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// {"signature":"swift::constraints::ConstraintSystem::setCapturedExpansions(swift::AnyFunctionRef, llvm::SmallVector<swift::PackExpansionExpr*, 1u>)"}
2+
// RUN: not --crash %target-swift-frontend -typecheck %s
3+
{
4+
repeat a {
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// {"signature":"recordTypeWitness(swift::NormalProtocolConformance*, swift::AssociatedTypeDecl*, swift::Type, swift::TypeDecl*)"}
2+
// RUN: not --crash %target-swift-frontend -typecheck %s
3+
protocol a{associatedtype b} protocol c
4+
: a{d(b)} protocol e{associatedtype f} extension e {
5+
protocol g : e, c { associatedtype f : c associatedtype b }
6+
struct h<i> : g {
7+
typealias f = i
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// {"signature":"(anonymous namespace)::ConstraintWalker::walkToExprPost(swift::Expr*)"}
2+
// RUN: not --crash %target-swift-frontend -typecheck %s
3+
\.+=
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// {"signature":"swift::ProtocolConformanceRef::getProtocol() const"}
2+
// RUN: not --crash %target-swift-frontend -typecheck %s
3+
func a<each b {
4+
enum c {
5+
case struct var d: e struct e {
6+
g: c }
7+
f {
8+
d.g == .struct
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// {"signature":"swift::constraints::Constraint::Constraint(swift::constraints::ConstraintKind, swift::Type, swift::Type, swift::constraints::ConstraintLocator*, llvm::SmallPtrSetImpl<swift::TypeVariableType*>&)"}
2+
// RUN: not --crash %target-swift-frontend -typecheck %s
3+
extension _UIntBuffer {
4+
a {
5+
struct b : OptionSet
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// {"signature":"swift::TuplePatternElt& llvm::SmallVectorTemplateBase<swift::TuplePatternElt, true>::growAndEmplaceBack<swift::Identifier, swift::SourceLoc, swift::Pattern*&>(swift::Identifier&&, swift::SourceLoc&&, swift::Pattern*&)"}
2+
// RUN: not --crash %target-swift-frontend -typecheck %s
3+
switch { case .a(&b
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// {"signature":"swift::DeclAndTypePrinter::Implementation::visitVarDecl(swift::VarDecl*)"}
2+
// RUN: not --crash %target-swift-frontend -typecheck %s
3+
#init
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// {"signature":"swift::DefaultAndMaxAccessLevelRequest::cacheResult(std::__1::pair<swift::AccessLevel, swift::AccessLevel>) const"}
2+
// RUN: not --crash %target-swift-frontend -typecheck %s
3+
struct a < b extension a where b : c, d == a {
4+
protocol c struct a
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// {"signature":"swift::GenericSignature::verify(llvm::ArrayRef<swift::Requirement>) const"}
2+
// RUN: not --crash %target-swift-frontend -typecheck %s
3+
protocol a {
4+
typealias b where Self : a protocol a
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// {"signature":"(anonymous namespace)::Verifier::verifyChecked(swift::Type)"}
2+
// RUN: not --crash %target-swift-frontend -typecheck %s
3+
class a < b {
4+
d {
5+
class e<c, b> : a struct f subscript<g>(h : e<f, g>) {
6+
h.d base
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// {"signature":"swift::Parser::parseStmtConditionElement(llvm::SmallVectorImpl<swift::StmtConditionElement>&, swift::Diag<>, swift::StmtKind, llvm::StringRef&)"}
2+
// RUN: not --crash %target-swift-frontend -typecheck %s
3+
func a: b[ if let
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// {"signature":"swift::AccessLevelRequest::cacheResult(swift::AccessLevel) const"}
2+
// RUN: not --crash %target-swift-frontend -typecheck %s
3+
class a < b extension a where c == d {
4+
protocol d
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// {"signature":"(anonymous namespace)::PreCheckTarget::walkToExprPre(swift::Expr*)"}
2+
// RUN: not --crash %target-swift-frontend -typecheck %s
3+
{
4+
extension a {
5+
b {
6+
func c {
7+
super
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// {"signature":"(anonymous namespace)::LookupResultBuilder::add(swift::ValueDecl*, swift::DeclContext*, swift::ValueDecl*, swift::Type, bool)::'lambda'(swift::ValueDecl*)::operator()(swift::ValueDecl*) const"}
2+
// RUN: not --crash %target-swift-frontend -typecheck %s
3+
protocol a{b} protocol c : a protocol d : c extension d {
4+
struct e : d {
5+
f {
6+
b
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// {"signature":"checkRequirementsImpl(llvm::ArrayRef<swift::Requirement>, bool)"}
2+
// RUN: not --crash %target-swift-frontend -typecheck %s
3+
struct a < Element {
4+
b {
5+
class c : Collection { typealias Index = d subscript(e :
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// {"signature":"Assertion failed: (detail::isPresent(Val) && \"dyn_cast on a non-existent value\"), function dyn_cast, file Casting.h, line 662."}
2+
// RUN: not --crash %target-swift-frontend -typecheck %s
3+
{
4+
extension {
5+
a {
6+
func b {
7+
super
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// {"signature":"(anonymous namespace)::Verifier::verifyParsed(swift::AbstractClosureExpr*)"}
2+
// RUN: not --crash %target-swift-frontend -typecheck %s
3+
func == {
4+
switch {
5+
case.a {
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// {"signature":"swift::constraints::MissingConformanceFailure::diagnoseTypeCannotConform(swift::Type, swift::Type) const"}
2+
// RUN: not --crash %target-swift-frontend -typecheck %s
3+
protocol a extension a {
4+
b { func * (Self= {
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// {"signature":"swift::ParamSpecifierRequest::evaluate(swift::Evaluator&, swift::ParamDecl*) const"}
2+
// RUN: not --crash %target-swift-frontend -typecheck %s
3+
func a([0])
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// {"signature":"swift::AvailabilityContext::Storage::get(swift::AvailabilityRange const&, bool, llvm::ArrayRef<swift::AvailabilityContext::DomainInfo>, swift::ASTContext const&)"}
2+
// RUN: not --crash %target-swift-frontend -typecheck %s
3+
protocol a extension a where b == Self{c : } typealias b : Sequence
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// {"signature":"swift::QueryInterfaceTypeSubstitutions::operator()(swift::SubstitutableType*) const"}
2+
// RUN: not --crash %target-swift-frontend -typecheck %s
3+
extension Collection where Self : a {
4+
struct Index protocol a
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// {"signature":"swift::constraints::RequirementFailure::RequirementFailure(swift::constraints::Solution const&, swift::Type, swift::Type, swift::constraints::ConstraintLocator*)"}
2+
// RUN: not --crash %target-swift-frontend -typecheck %s
3+
protocol a{associatedtype b} extension a where b == {
4+
protocol c var d : c {
5+
d
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// {"signature":"swift::constraints::Solution::getFunctionArgApplyInfo(swift::constraints::ConstraintLocator*) const"}
2+
// RUN: not --crash %target-swift-frontend -typecheck %s
3+
func a<b, each c>(d : repeat(b)->each c) { repeat d(e = f
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// {"signature":"swift::Parser::parseExprSequenceElement(swift::Diag<>, bool)"}
2+
// RUN: not --crash %target-swift-frontend -typecheck %s
3+
any a <
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// RUN: not --crash %target-swift-frontend -typecheck -library-level api %s
2+
// REQUIRES: OS=macosx
3+
4+
// https://github.com/swiftlang/swift/issues/81834
5+
public class C {
6+
public subscript() -> Int {
7+
get {
8+
extension C {}

0 commit comments

Comments
 (0)
0