-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of github.com:hylo-lang/hylo into coercions
- Loading branch information
Showing
106 changed files
with
1,053 additions
and
541 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,17 +52,15 @@ jobs: | |
|
||
runs-on: ${{ matrix.host.os }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- uses: actions/cache@v3 | ||
with: | ||
path: .build | ||
key: ${{ runner.os }}-spm-${{ hashFiles('**/Package.resolved') }} | ||
restore-keys: | | ||
${{ runner.os }}-spm- | ||
- uses: actions/checkout@v3 | ||
|
||
- run: git config --global core.autocrlf input | ||
|
||
- name: Build and Test | ||
uses: devcontainers/[email protected] | ||
with: | ||
|
@@ -108,8 +106,6 @@ jobs: | |
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- run: git config --global core.autocrlf input | ||
|
||
- name: Setup swift | ||
uses: swift-actions/setup-swift@v1 | ||
with: | ||
|
@@ -148,7 +144,7 @@ jobs: | |
https://github.com/apple/swift-package-manager/issues/6595" && false) ) | ||
build-native-windows: | ||
name: "Native: windows-latest/release" | ||
name: "Native, no testing: windows-latest/release" | ||
strategy: | ||
fail-fast: false | ||
runs-on: windows-latest | ||
|
@@ -159,8 +155,6 @@ jobs: | |
branch: swift-5.8.1-release | ||
tag: 5.8.1-RELEASE | ||
|
||
- run: | | ||
git config --global core.autocrlf input | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Swift version | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
name: Spell check | ||
on: [pull_request, push] | ||
|
||
jobs: | ||
run: | ||
name: Spell Check using typos | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout Actions Repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Check spelling of file.txt | ||
uses: crate-ci/[email protected] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[default.extend-words] | ||
inout = "inout" # Mutable projection keyword | ||
olt = "olt" # Abbreviation for "ordered less than" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
/// Projects `value` with its memory representation reinterpreted as a value of type `U`. | ||
public subscript unsafe_bitcast<T, U>(_ value: T): U { | ||
let { | ||
sink let p = Pointer<T>.to[value].copy().value | ||
yield p as* (remote let U) | ||
sink let p: Pointer<U> = Pointer(type_punning: pointer[to: value]) | ||
yield p.unsafe[] | ||
} | ||
inout { | ||
sink let p = Pointer<T>.to[value].copy().value | ||
yield &(p as* (remote inout U)) | ||
sink let p: PointerToMutable<U> = PointerToMutable(type_punning: pointerToMutable[&value]) | ||
yield &p.unsafe[] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// This type only exists because we don't seem to be able to make generic types like Pointer ForeignConvertible. | ||
/// A pointer type for use in @ffi signatures. | ||
type CVoidPointer: Regular { | ||
|
||
/// The underlying representation. | ||
var base: Builtin.ptr | ||
|
||
memberwise init | ||
|
||
} | ||
|
||
public conformance CVoidPointer: ForeignConvertible { | ||
|
||
public typealias ForeignRepresentation = Builtin.ptr | ||
|
||
public init(foreign_value: sink Builtin.ptr) { | ||
&self.base = foreign_value | ||
} | ||
|
||
public fun foreign_value() -> Builtin.ptr { | ||
base | ||
} | ||
|
||
} | ||
|
||
public conformance CVoidPointer: Copyable { | ||
|
||
/// Returns an equivalent instance. | ||
public fun copy() -> Self { | ||
CVoidPointer(base: base) | ||
} | ||
|
||
} | ||
|
||
public conformance CVoidPointer: Equatable { | ||
|
||
/// Returns `true` iff `other` has an equivalent value. | ||
public fun infix== (_ other: Self) -> Bool { | ||
Bool(value: Builtin.icmp_eq_ptr(base, other.base)) | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/// A type whose instances' values have a standard total ordering | ||
/// | ||
/// `<` is a total ordering; `a == b` implies that `a < b` and `b < a` are both false. | ||
public trait Comparable: Equatable { | ||
|
||
/// Returns `true` iff `self` is ordered before `other`. | ||
fun infix< (_ other: Self) -> Bool | ||
|
||
} | ||
|
||
extension Comparable { | ||
|
||
/// Returns `true` iff `self` is ordered after `other`. | ||
fun infix> (_ other: Self) -> Bool { (other < self) } | ||
|
||
/// Returns `false` iff `self` is ordered after `other`. | ||
fun infix<= (_ other: Self) -> Bool { !(other < self) } | ||
|
||
/// Returns `false` iff `self` is ordered before `other`. | ||
fun infix>= (_ other: Self) -> Bool { !(self < other) } | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/// A type whose instances' values can be compared for equivalence. | ||
/// | ||
/// `==` is an equivalence relation; i.e. `a == a`, `a == b` ⟺ `b == a`, and `a == b` ∧ `b == c` ⟹ | ||
/// `a == c`. | ||
public trait Equatable { | ||
|
||
/// Returns `true` iff `other` has an equivalent value. | ||
fun infix== (_ other: Self) -> Bool | ||
|
||
} | ||
|
||
extension Equatable { | ||
|
||
/// Returns `false` iff `other` has an equivalent value. | ||
public fun infix!= (_ other: Self) -> Bool { !(self == other) } | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// Can't really use this for anything yet due to https://github.com/hylo-lang/hylo/issues/936 | ||
/// A memory address. | ||
typealias MemoryAddress = PointerToMutable<Never> | ||
|
||
public extension PointerToMutable where Pointee == Never { | ||
|
||
/// Creates an instance pointing to the same address as `p` | ||
public init<T>(_ p: PointerToMutable<T>) { &self.base = p.base } | ||
|
||
/// Creates an instance pointing to the same address as `p` | ||
public init<T>(_ p: Pointer<T>) { &self.base = p.base } | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.