File: joe_monoid.swift

package info (click to toggle)
swiftlang 6.0.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,519,992 kB
  • sloc: cpp: 9,107,863; ansic: 2,040,022; asm: 1,135,751; python: 296,500; objc: 82,456; f90: 60,502; lisp: 34,951; pascal: 19,946; sh: 18,133; perl: 7,482; ml: 4,937; javascript: 4,117; makefile: 3,840; awk: 3,535; xml: 914; fortran: 619; cs: 573; ruby: 573
file content (45 lines) | stat: -rw-r--r-- 1,906 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
// RUN: %target-swift-frontend -typecheck %s -debug-generic-signatures 2>&1 | %FileCheck %s

// This is a funny monoid presentation from Joe Groff.

// CHECK-LABEL: joe_monoid.(file).O1@
// CHECK-LABEL: Requirement signature: <Self where Self == Self.[O1]C.[O1]C.[O1]C.[O1]C, Self.[O1]C : O1, Self.[O1]R : O1, Self.[O1]C.[O1]C == Self.[O1]R.[O1]C.[O1]C.[O1]R, Self.[O1]C.[O1]R.[O1]C == Self.[O1]R.[O1]C.[O1]R>
protocol O1 {
  associatedtype R : O1
  associatedtype C : O1
    where C.C.C.C == Self,
          C.C.R.C.C.R == Self,
          R.C.R.C.R.C == Self
}

// CHECK-LABEL: joe_monoid.(file).O2@
// CHECK-LABEL: Requirement signature: <Self where Self == Self.[O2]C.[O2]C.[O2]C.[O2]C, Self.[O2]C : O2, Self.[O2]R : O2, Self.[O2]C.[O2]C == Self.[O2]R.[O2]C.[O2]C.[O2]R, Self.[O2]C.[O2]R.[O2]C == Self.[O2]R.[O2]C.[O2]R>
protocol O2 {
  associatedtype R : O2
  associatedtype C : O2
    where Self == C.C.C.C,
          C.C.C.C == C.C.R.C.C.R,
          C.C.R.C.C.R == R.C.R.C.R.C
}

// The GSB incorrectly minimized this one, dropping all of the same-type requirements.

// CHECK-LABEL: joe_monoid.(file).O3@
// CHECK-LABEL: Requirement signature: <Self where Self == Self.[O3]C.[O3]C.[O3]C.[O3]C, Self.[O3]C : O3, Self.[O3]R : O3, Self.[O3]C.[O3]C == Self.[O3]R.[O3]C.[O3]C.[O3]R, Self.[O3]C.[O3]R.[O3]C == Self.[O3]R.[O3]C.[O3]R>
protocol O3 {
  associatedtype R : O3
  associatedtype C : O3
    where C.C.C.C == C.C.R.C.C.R,
          C.C.R.C.C.R == R.C.R.C.R.C,
          R.C.R.C.R.C == Self
}

// CHECK-LABEL: joe_monoid.(file).O4@
// CHECK-LABEL: Requirement signature: <Self where Self == Self.[O4]C.[O4]C.[O4]C.[O4]C, Self.[O4]C : O4, Self.[O4]R : O4, Self.[O4]C.[O4]C == Self.[O4]R.[O4]C.[O4]C.[O4]R, Self.[O4]C.[O4]R.[O4]C == Self.[O4]R.[O4]C.[O4]R>
protocol O4 {
  associatedtype R : O4
  associatedtype C : O4
    where Self == C.C.C.C,
          C.C == R.C.C.R,
          C.R.C == R.C.R
}