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 @@...@@ -6,7 +6,7 @@
66
7## 0.1.37## 0.1.3
88
9- feat(sema): coersion: numeric_literal -> float9- feat(sema): coercion: numeric_literal -> float
10- feat(sema): prevent passing non-runtime compatible types like `type` to opaque functions10- feat(sema): prevent passing non-runtime compatible types like `type` to opaque functions
11- feat(sema): properly validate and coerce binary operations11- feat(sema): properly validate and coerce binary operations
12- feat(sema): string concat with `+`12- feat(sema): string concat with `+`
...@@ -25,7 +25,7 @@...@@ -25,7 +25,7 @@
25## 0.1.225## 0.1.2
2626
27- feat: semantic analysis can return formatted errors to the user27- feat: semantic analysis can return formatted errors to the user
28- feat: implement basic type coersions28- feat: implement basic type coercions
29- feat: type-check call parameters29- feat: type-check call parameters
30- feat: type-check function return types30- feat: type-check function return types
31- feat: parsing of assignments within expressions is disallowed now31- 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...@@ -6,7 +6,7 @@ For a guide on how to use the language, please see the Language Reference docume
66
7## Building7## 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
11 zig build --release11 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...@@ -29,7 +29,7 @@ The `print` function is implemented by getting an external reference to the `con
2929
30## Primitive Data Types30## Primitive Data Types
3131
32| name | ts equivilent | description |32| name | ts equivalent | description |
33| ---------- | --------------------- | ---------------------------------------------- |33| ---------- | --------------------- | ---------------------------------------------- |
34| `int` | `number` | a number in signed 32-bit range |34| `int` | `number` | a number in signed 32-bit range |
35| `float` | `number` | a 64-bit floating point number |35| `float` | `number` | a 64-bit floating point number |
...@@ -95,7 +95,7 @@ let message = if @js("Math").random() > 0.5 {...@@ -95,7 +95,7 @@ let message = if @js("Math").random() > 0.5 {
95@js("console").log(message);95@js("console").log(message);
96```96```
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
100```lang100```lang
101var number = 0; // `number` is a `float`, but not explicit101var number = 0; // `number` is a `float`, but not explicit
...@@ -143,7 +143,7 @@ TODO...@@ -143,7 +143,7 @@ TODO
143143
144## JavaScript Interop144## 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
148> **Note**: A future update will improve on the type-safety of `opaque`148> **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) {...@@ -152,7 +152,7 @@ pub const AstError = union(enum) {
152 }, "{s}", .{switch (data.err) {152 }, "{s}", .{switch (data.err) {
153 error.OutOfMemory => unreachable,153 error.OutOfMemory => unreachable,
154 error.InvalidSyntax => "unexpected token",154 error.InvalidSyntax => "unexpected token",
155 error.TrailingNumericSeparator => "trailing numberic separator",155 error.TrailingNumericSeparator => "trailing numeric separator",
156 error.UnterminatedString => "unterminated string literal",156 error.UnterminatedString => "unterminated string literal",
157 error.InvalidEscapeSequence => "invalid escape sequence",157 error.InvalidEscapeSequence => "invalid escape sequence",
158 error.InvalidEscapeCodepoint => "invalid escape codepoint",158 error.InvalidEscapeCodepoint => "invalid escape codepoint",
src/core/Report.zig+3-3
...@@ -79,7 +79,7 @@ pub const Err = union(enum) {...@@ -79,7 +79,7 @@ pub const Err = union(enum) {
79 args: u32,79 args: u32,
8080
81 fn build(data: @This(), ctx: *MsgContext) !void {81 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}", .{
83 data.args,83 data.args,
84 ctx.ast.extraData(ctx.ast.nodeData(data.node).call.extra, Ast.Call).args.len,84 ctx.ast.extraData(ctx.ast.nodeData(data.node).call.extra, Ast.Call).args.len,
85 });85 });
...@@ -153,7 +153,7 @@ pub const Err = union(enum) {...@@ -153,7 +153,7 @@ pub const Err = union(enum) {
153 try ctx.msgNode(node, "numeric literal \"{d}\" cannot be coerced to \"int\"", .{data.val});153 try ctx.msgNode(node, "numeric literal \"{d}\" cannot be coerced to \"int\"", .{data.val});
154 }154 }
155 },155 },
156 coersion: struct {156 coercion: struct {
157 from: Type,157 from: Type,
158 to: Type,158 to: Type,
159 src: LazyNode,159 src: LazyNode,
...@@ -184,7 +184,7 @@ pub const Err = union(enum) {...@@ -184,7 +184,7 @@ pub const Err = union(enum) {
184184
185 fn build(data: @This(), ctx: *MsgContext) !void {185 fn build(data: @This(), ctx: *MsgContext) !void {
186 const node = try data.call.get(ctx);186 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}", .{
188 data.expected,188 data.expected,
189 data.actual,189 data.actual,
190 });190 });
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...@@ -718,7 +718,7 @@ fn coerceRef(s: *Sema, src: InstOp, value: Air.Inst.Ref, to: Type) !Air.Inst.Ref
718 },718 },
719 else => {},719 else => {},
720 }720 }
721 return s.coersionError(src, from, to);721 return s.coercionError(src, from, to);
722}722}
723723
724fn coerceValue(s: *Sema, src: InstOp, value: Value, to: Type) !Value {724fn 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 {...@@ -755,7 +755,7 @@ fn coerceValue(s: *Sema, src: InstOp, value: Value, to: Type) !Value {
755 },755 },
756 else => unreachable, // not a numeric literal756 else => unreachable, // not a numeric literal
757 },757 },
758 else => return s.coersionError(src, from, to),758 else => return s.coercionError(src, from, to),
759 },759 },
760 .float => switch (from) {760 .float => switch (from) {
761 .float => unreachable, // same type handled761 .float => unreachable, // same type handled
...@@ -786,7 +786,7 @@ fn coerceValue(s: *Sema, src: InstOp, value: Value, to: Type) !Value {...@@ -786,7 +786,7 @@ fn coerceValue(s: *Sema, src: InstOp, value: Value, to: Type) !Value {
786 .void => if (value == .void) return .void,786 .void => if (value == .void) return .void,
787 else => {},787 else => {},
788 }788 }
789 return s.coersionError(src, from, to);789 return s.coercionError(src, from, to);
790}790}
791791
792fn ensureValueRuntime(s: *Sema, src: InstOp, ref: Air.Inst.Ref) !Air.Inst.Ref {792fn 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(...@@ -1157,8 +1157,8 @@ fn fail(s: *Sema, comptime kind: Report.Err.FieldEnum, data: std.meta.FieldType(
1157 return Error.AnalysisFail;1157 return Error.AnalysisFail;
1158}1158}
11591159
1160fn coersionError(s: *Sema, src: InstOp, from: Type, to: Type) Error {1160fn coercionError(s: *Sema, src: InstOp, from: Type, to: Type) Error {
1161 return s.fail(.coersion, .{1161 return s.fail(.coercion, .{
1162 .from = from,1162 .from = from,
1163 .to = to,1163 .to = to,
1164 .src = s.lazyNode(src),1164 .src = s.lazyNode(src),
src/core/Teg.zig+1-1
...@@ -24,7 +24,7 @@ pub const Inst = struct {...@@ -24,7 +24,7 @@ pub const Inst = struct {
24 block,24 block,
25 /// Creates a memory cell in the current scope.25 /// Creates a memory cell in the current scope.
26 memory,26 memory,
27 /// Performs a type coersion, such as in variable declarations.27 /// Performs a type coercion, such as in variable declarations.
28 /// Emits a sema error if the type conversion fails.28 /// Emits a sema error if the type conversion fails.
29 /// `let x: i32 = 1`29 /// `let x: i32 = 1`
30 as,30 as,