authorchloe caruso <git@paperclover.net> 2024-06-02 21:39:16-07:00
committerchloe caruso <git@paperclover.net> 2024-06-02 21:39:16-07:00
logdef7b01d2c3b5d21675be8938b366a263dbab586
tree5b5717b10dd10fb791cbef0666bde62f245b0734
parent227021403e3604e6fc049ad2fa7575b05548244b

chore: fix more typos


7 files changed, 16 insertions(+), 16 deletions(-)

CHANGELOG.md+2-2
......@@ -6,7 +6,7 @@
66
77## 0.1.3
88
9- feat(sema): coersion: numeric_literal -> float
9- feat(sema): coercion: numeric_literal -> float
1010- feat(sema): prevent passing non-runtime compatible types like `type` to opaque functions
1111- feat(sema): properly validate and coerce binary operations
1212- feat(sema): string concat with `+`
......@@ -25,7 +25,7 @@
2525## 0.1.2
2626
2727- feat: semantic analysis can return formatted errors to the user
28- feat: implement basic type coersions
28- feat: implement basic type coercions
2929- feat: type-check call parameters
3030- feat: type-check function return types
3131- feat: parsing of assignments within expressions is disallowed now
README.md+1-1
......@@ -6,7 +6,7 @@ For a guide on how to use the language, please see the Language Reference docume
66
77## Building
88
9The primary dependency of the language SDK is a Zig compiler. If one is not available, the `./build` and `.\build.cmd` scripts can subsitute for running `zig build` on POSIX and Windows systems, respectively. With a Zig compiler, a release build can be produced in a single command:
9The primary dependency of the language SDK is a Zig compiler. If one is not available, the `./build` and `.\build.cmd` scripts can substitute for running `zig build` on POSIX and Windows systems, respectively. With a Zig compiler, a release build can be produced in a single command:
1010
1111 zig build --release
1212
doc/language-manual.md+3-3
......@@ -29,7 +29,7 @@ The `print` function is implemented by getting an external reference to the `con
2929
3030## Primitive Data Types
3131
32| name | ts equivilent | description |
32| name | ts equivalent | description |
3333| ---------- | --------------------- | ---------------------------------------------- |
3434| `int` | `number` | a number in signed 32-bit range |
3535| `float` | `number` | a 64-bit floating point number |
......@@ -95,7 +95,7 @@ let message = if @js("Math").random() > 0.5 {
9595@js("console").log(message);
9696```
9797
98It should be noted that numeric literals are a comptime-only data type, meaning it cannot be assigned to a `var` without an explicit type annotation. Since `int` is a strict subset of valid `float`s, the coersion will implicitly be a float, but a compiler warning will be emitted.
98It should be noted that numeric literals are a comptime-only data type, meaning it cannot be assigned to a `var` without an explicit type annotation. Since `int` is a strict subset of valid `float`s, the coercion will implicitly be a float, but a compiler warning will be emitted.
9999
100100```lang
101101var number = 0; // `number` is a `float`, but not explicit
......@@ -143,7 +143,7 @@ TODO
143143
144144## JavaScript Interop
145145
146A global variable handle can be retrived with `@js`. We've seen this in the hello world. The type of this value is a special type called `opaque`, which disables type-checking.
146A global variable handle can be retrieved with `@js`. We've seen this in the hello world. The type of this value is a special type called `opaque`, which disables type-checking.
147147
148148> **Note**: A future update will improve on the type-safety of `opaque`
149149
src/core/Parse.zig+1-1
......@@ -152,7 +152,7 @@ pub const AstError = union(enum) {
152152 }, "{s}", .{switch (data.err) {
153153 error.OutOfMemory => unreachable,
154154 error.InvalidSyntax => "unexpected token",
155 error.TrailingNumericSeparator => "trailing numberic separator",
155 error.TrailingNumericSeparator => "trailing numeric separator",
156156 error.UnterminatedString => "unterminated string literal",
157157 error.InvalidEscapeSequence => "invalid escape sequence",
158158 error.InvalidEscapeCodepoint => "invalid escape codepoint",
src/core/Report.zig+3-3
......@@ -79,7 +79,7 @@ pub const Err = union(enum) {
7979 args: u32,
8080
8181 fn build(data: @This(), ctx: *MsgContext) !void {
82 try ctx.msgNode(data.node, "built-in function expected {d} arguments, recieved {d}", .{
82 try ctx.msgNode(data.node, "built-in function expected {d} arguments, received {d}", .{
8383 data.args,
8484 ctx.ast.extraData(ctx.ast.nodeData(data.node).call.extra, Ast.Call).args.len,
8585 });
......@@ -153,7 +153,7 @@ pub const Err = union(enum) {
153153 try ctx.msgNode(node, "numeric literal \"{d}\" cannot be coerced to \"int\"", .{data.val});
154154 }
155155 },
156 coersion: struct {
156 coercion: struct {
157157 from: Type,
158158 to: Type,
159159 src: LazyNode,
......@@ -184,7 +184,7 @@ pub const Err = union(enum) {
184184
185185 fn build(data: @This(), ctx: *MsgContext) !void {
186186 const node = try data.call.get(ctx);
187 try ctx.msgNode(node, "function expected {d} arguments, recieved {d}", .{
187 try ctx.msgNode(node, "function expected {d} arguments, received {d}", .{
188188 data.expected,
189189 data.actual,
190190 });
src/core/Sema.zig+5-5
......@@ -718,7 +718,7 @@ fn coerceRef(s: *Sema, src: InstOp, value: Air.Inst.Ref, to: Type) !Air.Inst.Ref
718718 },
719719 else => {},
720720 }
721 return s.coersionError(src, from, to);
721 return s.coercionError(src, from, to);
722722}
723723
724724fn coerceValue(s: *Sema, src: InstOp, value: Value, to: Type) !Value {
......@@ -755,7 +755,7 @@ fn coerceValue(s: *Sema, src: InstOp, value: Value, to: Type) !Value {
755755 },
756756 else => unreachable, // not a numeric literal
757757 },
758 else => return s.coersionError(src, from, to),
758 else => return s.coercionError(src, from, to),
759759 },
760760 .float => switch (from) {
761761 .float => unreachable, // same type handled
......@@ -786,7 +786,7 @@ fn coerceValue(s: *Sema, src: InstOp, value: Value, to: Type) !Value {
786786 .void => if (value == .void) return .void,
787787 else => {},
788788 }
789 return s.coersionError(src, from, to);
789 return s.coercionError(src, from, to);
790790}
791791
792792fn ensureValueRuntime(s: *Sema, src: InstOp, ref: Air.Inst.Ref) !Air.Inst.Ref {
......@@ -1157,8 +1157,8 @@ fn fail(s: *Sema, comptime kind: Report.Err.FieldEnum, data: std.meta.FieldType(
11571157 return Error.AnalysisFail;
11581158}
11591159
1160fn coersionError(s: *Sema, src: InstOp, from: Type, to: Type) Error {
1161 return s.fail(.coersion, .{
1160fn coercionError(s: *Sema, src: InstOp, from: Type, to: Type) Error {
1161 return s.fail(.coercion, .{
11621162 .from = from,
11631163 .to = to,
11641164 .src = s.lazyNode(src),
src/core/Teg.zig+1-1
......@@ -24,7 +24,7 @@ pub const Inst = struct {
2424 block,
2525 /// Creates a memory cell in the current scope.
2626 memory,
27 /// Performs a type coersion, such as in variable declarations.
27 /// Performs a type coercion, such as in variable declarations.
2828 /// Emits a sema error if the type conversion fails.
2929 /// `let x: i32 = 1`
3030 as,