Skip to content

Commit 71dbad5

Browse files
committed
Fix SemiRegular.
Fixes #1620. Another pass to loosen some constraints now that SemiRegular refines Copyable is warranted.
1 parent 02a00f3 commit 71dbad5

File tree

3 files changed

+12
-7
lines changed

3 files changed

+12
-7
lines changed

StandardLibrary/Sources/Array.hylo

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ public type Array<Element: SemiRegular>: SemiRegular {
207207

208208
}
209209

210-
public conformance Array: Equatable {
210+
public conformance Array: Equatable where Element: Equatable {
211211

212212
/// Returns `true` iff `other` has an equivalent value.
213213
public fun infix== (_ other: Self) -> Bool {

StandardLibrary/Sources/Core/Regular.hylo

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
///
44
/// - Move is value-preserving.
55
/// - Destruction has no side-effects.
6-
public trait SemiRegular: Deinitializable, Movable, Equatable {}
6+
public trait SemiRegular: Copyable, Deinitializable {}
77

88
/// Regular types (roughly per Stepanov).
99
///
1010
/// Copies have equal value.
11-
public trait Regular: SemiRegular, Copyable {}
11+
public trait Regular: SemiRegular, Equatable {}

Tests/HyloTests/TestCases/TypeChecking/AbstractType.hylo

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
11
//- typeCheck expecting: .success
22

3-
trait P: SemiRegular {
4-
type T: SemiRegular
5-
type U: SemiRegular
3+
// Our SemiRegular when this test was written wasn't the genuine
4+
// SemiRegular but was being depended on by this test, so rephrasing
5+
// it here.
6+
trait LegacySemiRegular: Deinitializable, Movable, Equatable {}
7+
8+
trait P: LegacySemiRegular {
9+
type T: LegacySemiRegular
10+
type U: LegacySemiRegular
611

712
fun t(_ x: T)
813
fun u(_ x: U)
914
}
1015

11-
trait Q: SemiRegular {
16+
trait Q: LegacySemiRegular {
1217
type V: P
1318
property v: V { let }
1419
}

0 commit comments

Comments
 (0)