Files
swift-mirror/validation-test/compiler_crashers_2/sr8968.swift
Slava Pestov 91ebe4485c GSB: Move signature verification from CanGenericSignature::getCanonical() to computeGenericSignature()
Doing this when computing a canonical signature didn't really
make sense because canonical signatures are not canonicalized
any more strongly _with respect to the builder_; they just
canonicalize their requirement types.

Instead, let's do these checks after creating the signature in
computeGenericSignature().

The old behavior had another undesirable property; since the
canonicalization was done by registerGenericSignatureBuilder(),
we would always build a new GSB from scratch for every
signature we compute.

The new location also means we do these checks for protocol
requirement signatures as well. This flags an existing fixed
crasher where we still emit bogus same-type requirements in
the requirement signature, so I moved this test back into
an unfixed state.
2021-03-11 21:07:33 -05:00

49 lines
1.4 KiB
Swift

// RUN: not --crash %target-swift-frontend -emit-ir %s
// REQUIRES: asserts
public class OFMAttachment : NativeInserting {
public typealias SnapshotType = Message.Attachment
}
public protocol Snapshotting {
associatedtype NativeType: NativeInserting where NativeType.SnapshotType == Self
associatedtype RecordType: SnapshotRecord where RecordType.SnapshotType == Self
associatedtype ChangeType: SnapshotChange where ChangeType.SnapshotType == Self
static var baseMessageName: String { get }
}
public protocol NativeInserting {
associatedtype SnapshotType : Snapshotting where SnapshotType.NativeType == Self
}
public protocol SnapshotRecord {
associatedtype SnapshotType : Snapshotting where SnapshotType.RecordType == Self
}
public protocol SnapshotChange {
associatedtype SnapshotType : Snapshotting where SnapshotType.ChangeType == Self
}
public struct Message {
public enum Attachment : Snapshotting {
public static var baseMessageName: String = "attachment"
public typealias NativeType = OFMAttachment
public typealias RecordType = Record
public typealias ChangeType = Change
public struct Record : SnapshotRecord {
public typealias SnapshotType = Message.Attachment
}
public struct Change : SnapshotChange {
public typealias SnapshotType = Message.Attachment
}
}
}