Skip to content
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

Fix semiregular #1622

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion Sources/FrontEnd/TypedProgram.swift
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ public struct TypedProgram {
}

/// The type checking of a collection of source files.
private final class TypeCheckTask: Operation {
private final class TypeCheckTask: Operation, @unchecked Sendable {

/// The sources to check.
private let sources: [TranslationUnit.ID]
Expand Down
4 changes: 2 additions & 2 deletions StandardLibrary/Sources/Array.hylo
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/// An ordered, random-access collection.
public type Array<Element: SemiRegular>: SemiRegular {
public type Array<Element: Movable & Deinitializable>: Movable, Deinitializable {

/// The out-of-line storage of the array.
///
Expand Down Expand Up @@ -207,7 +207,7 @@ public type Array<Element: SemiRegular>: SemiRegular {

}

public conformance Array: Equatable {
public conformance Array: Equatable where Element: Equatable {

/// Returns `true` iff `other` has an equivalent value.
public fun infix== (_ other: Self) -> Bool {
Expand Down
2 changes: 1 addition & 1 deletion StandardLibrary/Sources/Core/Range.hylo
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/// A half-open interval from a lower bound up to, but not including, an uppor bound.
public type Range<Bound: SemiRegular & Comparable> {
public type Range<Bound: Movable & Deinitializable & Comparable> {

// TODO: private(set)
/// The minimum value included in `self`.
Expand Down
4 changes: 2 additions & 2 deletions StandardLibrary/Sources/Core/Regular.hylo
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
///
/// - Move is value-preserving.
/// - Destruction has no side-effects.
public trait SemiRegular: Deinitializable, Movable, Equatable {}
public trait SemiRegular: Copyable, Deinitializable {}

/// Regular types (roughly per Stepanov).
///
/// Copies have equal value.
public trait Regular: SemiRegular, Copyable {}
public trait Regular: SemiRegular, Equatable {}
13 changes: 9 additions & 4 deletions Tests/HyloTests/TestCases/TypeChecking/AbstractType.hylo
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
//- typeCheck expecting: .success

trait P: SemiRegular {
type T: SemiRegular
type U: SemiRegular
// Our SemiRegular when this test was written wasn't the genuine
// SemiRegular but was being depended on by this test, so rephrasing
// it here.
trait LegacySemiRegular: Deinitializable, Movable, Equatable {}

trait P: LegacySemiRegular {
type T: LegacySemiRegular
type U: LegacySemiRegular

fun t(_ x: T)
fun u(_ x: U)
}

trait Q: SemiRegular {
trait Q: LegacySemiRegular {
type V: P
property v: V { let }
}
Expand Down
Loading