Skip to content

Commit 2e6fd16

Browse files
committed
[test] Add a few more known type-checker crashers
1 parent d3abee7 commit 2e6fd16

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+207
-1
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// {"signature":"swift::constraints::FunctionTypeMismatch::FunctionTypeMismatch(swift::constraints::Solution const&, swift::ContextualTypePurpose, swift::Type, swift::Type, llvm::ArrayRef<unsigned int>, swift::constraints::ConstraintLocator*)"}
2+
// RUN: not --crash %target-swift-frontend -typecheck %s
3+
func a< each b >->(Int, repeat each b)Float= a(
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// {"signature":"swift::ExtensionDecl::getExtendedNominal() const"}
2+
// RUN: not --crash %target-swift-frontend -typecheck %s
3+
extension a {}
4+
func b < >>
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// {"signature":"swift::constraints::SolverTrail::~SolverTrail()"}
2+
// RUN: not --crash %target-swift-frontend -typecheck %s
3+
enum a< b { case c(}
4+
func d< b >(b->a< b >) d(a< e >.c let a
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// {"signature":"swift::rewriting::PropertyMap::addSuperclassProperty(swift::rewriting::Term, swift::rewriting::Symbol, unsigned int)"}
2+
// RUN: not --crash %target-swift-frontend -typecheck %s
3+
class a < b class c : a func d < b where b : a<Int>, b : c
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// {"signature":"lookupReplacedDecl(swift::DeclNameRef, swift::DeclAttribute const*, swift::ValueDecl const*, llvm::SmallVectorImpl<swift::ValueDecl*>&)"}
2+
// RUN: not --crash %target-swift-frontend -typecheck %s
3+
{ @_dynamicReplacement(for: ) func a
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// {"signature":"(anonymous namespace)::ExprWalker::walkToExprPost(swift::Expr*)"}
2+
// RUN: not --crash %target-swift-frontend -typecheck %s
3+
func a {
4+
{
5+
\ b() a
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// {"signature":"swift::constraints::ConstraintSystem::setClosureType(swift::ClosureExpr const*, swift::FunctionType*)"}
2+
// RUN: not --crash %target-swift-frontend -typecheck %s
3+
protocol b let c = {(a : b)in switch a{case.d {
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// {"signature":"swift::InFlightSubstitution::lookupConformance(swift::Type, swift::ProtocolDecl*, unsigned int)"}
2+
// RUN: not --crash %target-swift-frontend -typecheck %s
3+
typealias a<b, c, d> = () struct e < each b {
4+
typealias f<each c, d> = (repeat a<each b, each c, d>)struct g < each c {
5+
typealias h< each d > = (repeat f< repeat each c, each d >
6+
struct i typealias j< each d > =
7+
e< i >.g< repeat each b >.h< repeat each d >
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// {"signature":"swift::TypeBase::getOptionalObjectType()"}
2+
// RUN: not --crash %target-swift-frontend -typecheck %s
3+
enum a { b } {
4+
let:
5+
String->a = a.b
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// {"signature":"swift::constraints::ConstraintLocator::isKeyPathMemberComponent() const"}
2+
// RUN: not --crash %target-swift-frontend -typecheck %s
3+
\_(error)
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// {"signature":"(anonymous namespace)::ConnectedComponents::unionSets(swift::TypeVariableType*, swift::TypeVariableType*)"}
2+
// RUN: not --crash %target-swift-frontend -typecheck %s
3+
let b = ( c , d a {
4+
e b
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// {"signature":"$s11swiftASTGen19addQueuedDiagnostic20queuedDiagnosticsPtr011perFrontende5StateH04text8severity4cLoc12categoryName17documentationPath015highlightRangesH0012numHighlightT013fixItsUntypedySv_SvSo16BridgedStringRefVSo0zE8SeverityVSo0z6SourceN0VA2NSPySo0Z15CharSourceRangeVGSgSiSo0Z8ArrayRefVtF"}
2+
// RUN: not --crash %target-swift-frontend -typecheck %s
3+
// REQUIRES: swift_swift_parser
4+
class a { @objc ( : ( b
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// {"signature":"std::__1::optional<swift::Type> llvm::function_ref<std::__1::optional<swift::Type> (swift::TypeBase*)>::callback_fn<swift::constraints::FailureDiagnostic::resolveType(swift::Type, bool, bool) const::$_0>(long, swift::TypeBase*)"}
2+
// RUN: not --crash %target-swift-frontend -typecheck %s
3+
Array(repeat a
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// {"signature":"swift::constraints::ConstraintSystem::addFix(swift::constraints::ConstraintFix*)"}
2+
// RUN: not --crash %target-swift-frontend -typecheck %s
3+
func a<b>(b) -> b a(["":0]) as [Int:String]
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// {"signature":"swift::constraints::ConstraintSystem::recordOpenedTypes(swift::constraints::ConstraintLocatorBuilder, llvm::SmallVectorImpl<std::__1::pair<swift::GenericTypeParamType*, swift::TypeVariableType*>>&, bool)"}
2+
// RUN: not --crash %target-swift-frontend -typecheck %s
3+
a<b> class a func a < c class b < d
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// {"signature":"swift::diagnoseArgumentLabelError(swift::ASTContext&, swift::ArgumentList const*, llvm::ArrayRef<swift::Identifier>, swift::ParameterContext, swift::InFlightDiagnostic*)"}
2+
// RUN: not --crash %target-swift-frontend -typecheck %s
3+
func a<b>((), c : ()->b) a {}
4+
c : {
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// {"signature":"swift::DeclAttribute::printImpl(swift::ASTPrinter&, swift::PrintOptions const&, swift::Decl const*) const"}
2+
// RUN: not --crash %target-swift-frontend -typecheck %s
3+
protocol a { associatedtype b }
4+
public
5+
struct c < d : a extension c {
6+
public
7+
typealias e = d.b
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// {"signature":"swift::constraints::ConstraintSystem::getCalleeLocator(swift::constraints::ConstraintLocator*, bool, llvm::function_ref<swift::Type (swift::Expr*)>, llvm::function_ref<swift::Type (swift::Type)>, llvm::function_ref<std::__1::optional<swift::constraints::SelectedOverload> (swift::constraints::ConstraintLocator*)>)"}
2+
// RUN: not --crash %target-swift-frontend -typecheck %s
3+
struct a func b(c : [Int]) {
4+
\ a(c.map{})
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// {"signature":"swift::InFlightSubstitution::substType(swift::SubstitutableType*, unsigned int)"}
2+
// RUN: not --crash %target-swift-frontend -typecheck %s
3+
typealias a< each b > = ( < struct c< each d {
4+
typealias e< each b > = (repeat a< each d, each b >
5+
struct f typealias 1 = c .e<>
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// {"signature":"swift::PackType::getSingletonPackExpansion(swift::Type)"}
2+
// RUN: not --crash %target-swift-frontend -typecheck %s
3+
class a func b < each c : a {
4+
b
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// {"signature":"swift::EnumRawValuesRequest::evaluate(swift::Evaluator&, swift::EnumDecl*, swift::TypeResolutionStage) const"}
2+
// RUN: not --crash %target-swift-frontend -typecheck %s
3+
func a<each b>(c : repeat each b) { repeat !(d c
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// {"signature":"std::__1::__function::__func<resolveTypeWitnessViaLookup(swift::NormalProtocolConformance*, swift::AssociatedTypeDecl*)::$_3, std::__1::allocator<resolveTypeWitnessViaLookup(swift::NormalProtocolConformance*, swift::AssociatedTypeDecl*)::$_3>, void (swift::NormalProtocolConformance*)>::~__func()"}
2+
// RUN: not --crash %target-swift-frontend -typecheck %s
3+
struct b let b c a = b protocol a : a
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// {"signature":"swift::constraints::ContextualFailure::diagnoseConversionToBool() const"}
2+
// RUN: not --crash %target-swift-frontend -typecheck %s
3+
@propertyWrapper struct a {
4+
wrappedValue : Bool {
5+
@a var b : Int
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// {"signature":"swift::ProtocolConformanceRef::forEachMissingConformance(llvm::function_ref<bool (swift::BuiltinProtocolConformance*)>) const"}
2+
// RUN: not --crash %target-swift-frontend -typecheck %s
3+
.a == .! == b / c
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// {"signature":"swift::PackType::getExpandedGenericArgs(llvm::ArrayRef<swift::GenericTypeParamType*>, llvm::ArrayRef<swift::Type>)"}
2+
// RUN: not --crash %target-swift-frontend -typecheck %s
3+
struct a < each b typealias c<each d> = a<> c < e
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// {"signature":"swift::SourceFile::getIfConfigClausesWithin(swift::SourceRange) const"}
2+
// RUN: not --crash %target-swift-frontend -typecheck %s
3+
{
4+
if
5+
case.(let \ a) { a
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// {"signature":"swift::constraints::ConstraintSystem::resolveOverload(swift::constraints::ConstraintLocator*, swift::Type, swift::constraints::OverloadChoice, swift::DeclContext*)"}
2+
// RUN: not --crash %target-swift-frontend -typecheck %s
3+
struct a func b(c : a) {
4+
{
5+
switch
6+
c { case .baz(c==
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// {"signature":"conformsToInvertible(swift::CanType, swift::InvertibleProtocolKind)"}
2+
// RUN: not --crash %target-swift-frontend -typecheck %s
3+
typealias a = FlattenCollection...
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// {"signature":"swift::TypeBase::removeArgumentLabels(unsigned int)"}
2+
// RUN: not --crash %target-swift-frontend -typecheck %s
3+
struct a dynamic subscript(b c: Int) a subscript(b c: Int) a @_dynamicReplacement(for: subscript) subscript(Int) a { }
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// {"signature":"$s11swiftASTGen15parseSourceFile6buffer10moduleName8filename14declContextPtr4kindSVSo16BridgedStringRefV_A2ISvSgSo0n9GenerateddE4KindVtF"}
2+
// RUN: not --crash %target-swift-frontend -typecheck %s
3+
// REQUIRES: swift_swift_parser
4+
#sourceLocation """\("
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// {"signature":"swift::constraints::AllowTypeOrInstanceMemberFailure::diagnoseAsError()"}
2+
// RUN: not --crash %target-swift-frontend -typecheck %s
3+
struct a func b<c >(c = a [
4+
extension a {
5+
subscript->Int
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// {"signature":"swift::AbstractStorageDecl::mutability(swift::DeclContext const*, std::__1::optional<swift::DeclRefExpr const*>) const"}
2+
// RUN: not --crash %target-swift-frontend -typecheck %s
3+
@propertyWrapper struct a {
4+
@a $b:
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// {"signature":"swift::ide::printTypeUSR(swift::Type, llvm::raw_ostream&)"}
2+
// RUN: not --crash %target-swift-frontend -typecheck %s
3+
class a {
4+
class b < c class e : a<> {
5+
d = b
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
// {"signature":"swift::Parser::parseStmtConditionElement(llvm::SmallVectorImpl<swift::StmtConditionElement>&, swift::Diag<>, swift::StmtKind, llvm::StringRef&)"}
22
// RUN: not --crash %target-swift-frontend -typecheck %s
3-
func a: b[ if let
3+
func a: b[ if let
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// {"signature":"swift::constraints::MissingCallFailure::diagnoseAsError()"}
2+
// RUN: not --crash %target-swift-frontend -typecheck %s
3+
struct a < each b {
4+
init(repeat each b) func c < each d { a<repeat each d, String >(repeat e, {
5+
""
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// {"signature":"swift::GenericEnvironment::getOrCreateArchetypeFromInterfaceType(swift::Type)"}
2+
// RUN: not --crash %target-swift-frontend -typecheck %s
3+
@resultBuilder enum a < b { struct c{@a d:
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// {"signature":"swift::TypeChecker::checkObjCKeyPathExpr(swift::DeclContext*, swift::KeyPathExpr*, bool)"}
2+
// RUN: not --crash %target-swift-frontend -typecheck %s
3+
// REQUIRES: objc_interop
4+
#keyPath(
5+
print
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// {"signature":"swift::constraints::ConstraintSystem::associateArgumentList(swift::constraints::ConstraintLocator*, swift::ArgumentList*)"}
2+
// RUN: not --crash %target-swift-frontend -typecheck %s
3+
protocol b let b = { (a : b)in switch a { case .c(d(
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// {"signature":"(anonymous namespace)::DeclChecker::visit(swift::Decl*)"}
2+
// RUN: not --crash %target-swift-frontend -typecheck %s
3+
extension(a[ 0.0 b
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// {"signature":"diagSyntacticUseRestrictions(swift::Expr const*, swift::DeclContext const*, bool)::DiagnoseWalker::walkToExprPre(swift::Expr*)"}
2+
// RUN: not --crash %target-swift-frontend -typecheck %s
3+
{ @#b([a:
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// {"signature":"(anonymous namespace)::ExprRewriter::coerceCallArguments(swift::ArgumentList*, swift::AnyFunctionType*, swift::ConcreteDeclRef, swift::ApplyExpr*, swift::constraints::ConstraintLocatorBuilder, llvm::ArrayRef<swift::AppliedPropertyWrapper>)"}
2+
// RUN: not --crash %target-swift-frontend -typecheck %s
3+
func a<b, each c>(body : (repeat each c)->b) { body(
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// {"signature":"swift::constraints::Constraint::create(swift::constraints::ConstraintSystem&, swift::constraints::ConstraintKind, swift::Type, swift::Type, swift::constraints::ConstraintLocator*, llvm::ArrayRef<swift::TypeVariableType*>)"}
2+
// RUN: not --crash %target-swift-frontend -typecheck %s
3+
protocol a let : a.Type.Type = b->c
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// {"signature":"swift::constraints::DisjunctionChoiceProducer::partitionGenericOperators(unsigned int*, unsigned int*)"}
2+
// RUN: not --crash %target-swift-frontend -typecheck %s
3+
{
4+
print($0) $00 + 0. / 1
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// {"signature":"swift::constraints::ExpandArrayIntoVarargsFailure::tryDropArrayBracketsFixIt(swift::Expr const*) const"}
2+
// RUN: not --crash %target-swift-frontend -typecheck %s
3+
ExpressibleByDictionaryLiteral([]
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// {"signature":"(anonymous namespace)::ExprRewriter::buildSingleCurryThunk(swift::Expr*, swift::Expr*, swift::DeclContext*, swift::FunctionType*, swift::constraints::ConstraintLocatorBuilder)"}
2+
// RUN: not --crash %target-swift-frontend -typecheck %s
3+
// REQUIRES: OS=macosx
4+
import Foundation func a(b: AnyClass?) { b (b
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// {"signature":"swift::ProtocolConformanceRef::forAbstract(swift::Type, swift::ProtocolDecl*)"}
2+
// RUN: not --crash %target-swift-frontend -typecheck %s
3+
@resultBuilder struct a {
4+
static buildBlock<b, c, d, e>(b, c, d, e) func f<h>(_ : Bool @a Bool->h) { f(true {
5+
cond in var g : Int g 2 30\ g
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// {"signature":"swift::FunctionType::get(llvm::ArrayRef<swift::AnyFunctionType::Param>, swift::Type, std::__1::optional<swift::ASTExtInfo>)"}
2+
// RUN: not --crash %target-swift-frontend -typecheck %s
3+
struct a < b : FixedWidthInteger extension a : Sequence {
4+
c {
5+
{ for
6+
d self { b(truncatingIfNeeded : d
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// {"signature":"swift::constraints::ConstraintSystem::matchFunctionTypes(swift::FunctionType*, swift::FunctionType*, swift::constraints::ConstraintKind, swift::optionset::OptionSet<swift::constraints::ConstraintSystem::TypeMatchFlags, unsigned int>, swift::constraints::ConstraintLocatorBuilder)"}
2+
// RUN: not --crash %target-swift-frontend -typecheck %s
3+
func a b _openExistential((c a
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// {"signature":"(anonymous namespace)::ExprRewriter::finishApply(swift::ApplyExpr*, swift::Type, swift::constraints::ConstraintLocatorBuilder, swift::constraints::ConstraintLocatorBuilder)"}
2+
// RUN: not --crash %target-swift-frontend -typecheck %s
3+
func a(b : ()->Void c : _->Void) { withoutActuallyEscaping(b do : c
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// {"signature":"swift::constraints::ConstraintSystem::setTargetFor(swift::constraints::SyntacticElementTargetKey, swift::constraints::SyntacticElementTarget)"}
2+
// RUN: not --crash %target-swift-frontend -typecheck %s
3+
{$0=[{} }(
4+
[a:
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// {"signature":"(anonymous namespace)::ActorIsolationChecker::checkLocalCaptures(swift::AnyFunctionRef)"}
2+
// RUN: not --crash %target-swift-frontend -typecheck %s
3+
struct a {
4+
b : c =, d = {} protocol c
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// {"signature":"swift::TypeBase::getContextSubstitutions(swift::DeclContext const*, swift::GenericEnvironment*)"}
2+
// RUN: not --crash %target-swift-frontend -typecheck %s
3+
{ $0?={
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// {"signature":"makeBinOp(swift::ASTContext&, swift::Expr*, swift::Expr*, swift::Expr*, swift::PrecedenceGroupDecl*, bool)"}
2+
// RUN: not --crash %target-swift-frontend -typecheck %s
3+
let a= switch a { case &b as? b
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// {"signature":"deriveBodyRawRepresentable_init(swift::AbstractFunctionDecl*, void*)"}
2+
// RUN: not --crash %target-swift-frontend -typecheck %s
3+
a enum a : Int { case = #/

0 commit comments

Comments
 (0)