Skip to content

A couple of regression tests #32132

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
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
55 changes: 55 additions & 0 deletions validation-test/compiler_crashers_2_fixed/rdar54394068.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
// RUN: %target-swift-frontend -typecheck -verify %s

protocol A {
associatedtype BType: B where BType.AType == Self
associatedtype CType: C where CType.AType == Self

var b: BType { get }
var c: CType { get set }

func bGetter() -> BType
mutating func cSetter(_ newC: CType)

subscript (b: BType) -> CType { get set }
}

protocol B {
associatedtype AType: A
}

protocol C {
associatedtype AType: A
}

struct AImpl: A {
typealias BType = BImpl
typealias CType = CImpl

let b: BImpl
var c: CImpl

func bGetter() -> BImpl {
return b
}

mutating func cSetter(_ newC: CImpl) {
c = newC
}

subscript(b: BImpl) -> CImpl {
get {
return c
}
set {
c = newValue
}
}
}

struct BImpl: B {
typealias AType = AImpl
}

struct CImpl: C {
typealias AType = AImpl
}
8 changes: 8 additions & 0 deletions validation-test/compiler_crashers_2_fixed/sr7002.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// RUN: not %target-swift-frontend -typecheck %s

struct Foo: OptionSet {
let rawValue: Int
static let none = Foo(rawValue: 1 << 0)
}

extension Foo: ExpressibleByIntegerLiteral { }