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

chore: fix various typos & add typos.yml CI #127

Merged
merged 1 commit into from
Jan 13, 2025
Merged
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
17 changes: 17 additions & 0 deletions .github/workflows/typos.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Check typos

on:
push:
branches: ["master"]
pull_request:
workflow_dispatch:

jobs:
check-typos:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Run spellcheck
uses: crate-ci/typos@master
8 changes: 4 additions & 4 deletions src/julec/obj/cxx/object.jule
Original file line number Diff line number Diff line change
Expand Up @@ -710,7 +710,7 @@ impl ObjectCoder {
self.indent()
self.write("return ")
self.addIndent()
mut writed := false
mut written := false

// Common model for custom expressions.
mut lmodel := "_self_->"
Expand All @@ -722,10 +722,10 @@ impl ObjectCoder {
if strct != nil && strct.Decl != nil && strct.Decl.Binded {
continue
}
if writed {
if written {
self.write(" &&")
}
writed = true
written = true
self.write("\n")
self.indent()

Expand All @@ -739,7 +739,7 @@ impl ObjectCoder {
rmodel = rmodel[:len(rmodel)-fIdent.Len()]
}
self.doneIndent()
if !writed {
if !written {
self.write("true")
}
self.write(";\n")
Expand Down
10 changes: 5 additions & 5 deletions src/julec/obj/cxx/scope.jule
Original file line number Diff line number Diff line change
Expand Up @@ -452,19 +452,19 @@ impl scopeCoder {
}

fn conditional(mut &self, mut c: &sema::Conditional) {
mut writed := false
mut written := false
for (_, mut elif) in c.Elifs {
if elif == nil {
continue
}
if writed {
if written {
self.oc.write(" else ")
}
writed = true
written = true
self.ifCase(elif)
}
if c.Default != nil {
if writed {
if written {
self.oc.write(" else ")
}
self.scope(c.Default.Scope)
Expand Down Expand Up @@ -1371,7 +1371,7 @@ impl scopeCoder {
}
}
} else if len(f.Decl.Result.Idents) == 1 {
// Non-tuple signle return type with identifier.
// Non-tuple single return type with identifier.
// Use [resultName] as identifier.
self.oc.indent()
self.oc.tc.kind(self.oc.Buf, f.Result)
Expand Down
2 changes: 1 addition & 1 deletion src/julec/opt/expr.jule
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ impl exprOptimizer {
// Tries optimize binary expression for neutral elements.
// Specialized in math optimizations.
fn tryNeutralElement(self, mut &m: &sema::BinaryExpr): bool {
// For netural element optimization, one of the operands should be constant.
// For neutral element optimization, one of the operands should be constant.
match type m.Left.Model {
| &constant::Const:
mut c := (&constant::Const)(m.Left.Model)
Expand Down
2 changes: 1 addition & 1 deletion src/julec/opt/scope.jule
Original file line number Diff line number Diff line change
Expand Up @@ -815,7 +815,7 @@ impl scopeOptimizer {
// Expressions will be more simple, so analysis may have optimization chance.
self.normalizeAssign(assign, tup)

// Split assignments as a signle assignment if possible.
// Split assignments as a single assignment if possible.
// Because multi-assign expressions use temporary values.
// So, remove temporary variables using single assignments if possible.
self.splitAssign(assign, tup)
Expand Down
2 changes: 1 addition & 1 deletion std/bufio/scan.jule
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ struct Scanner {
start: int // First non-processed byte in buf.
end: int // End of data in buf.
empties: int // Count of successive empty tokens.
mut tok: []byte // The last readed token.
mut tok: []byte // The last read token.
}

impl Scanner {
Expand Down
4 changes: 2 additions & 2 deletions std/encoding/json/decode.jule
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ impl jsonDecoder {
ret lit
}

// Scans inputs quicky, not checks validity.
// Scans inputs efficiently, not checks validity.
// Only checks for length.
fn scanLit(self)!: []byte {
i := self.i
Expand Down Expand Up @@ -436,7 +436,7 @@ impl jsonDecoder {
// Tries to use custom decoding method if exist for supported types.
// Reports whether it found and decoded successfully.
// Forwards any exception, all exceptionals are forwarded.
// So, any exception means custom decode method found and it throwed exception.
// So, any exception means custom decode method found and it threw exception.
fn tryCustomDecode[T](self, mut &t: T)!: bool {
const tt = comptime::TypeOf(T)
const match {
Expand Down
16 changes: 8 additions & 8 deletions std/encoding/json/decode_test.jule
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ fn testCustomDecode(t: &testing::T) {
mut b := []byte("false")
mut a := new(abc, -1)
Decode(b, a) else {
t.Errorf("want 0, throwed exception")
t.Errorf("want 0, threw exception")
*a = 0
}
if *a != 0 {
Expand All @@ -229,7 +229,7 @@ fn testCustomDecode(t: &testing::T) {
*a = -1
b = []byte("true")
Decode(b, a) else {
t.Errorf("want 1, throwed exception")
t.Errorf("want 1, threw exception")
*a = 1
}
if *a != 1 {
Expand All @@ -242,7 +242,7 @@ fn testCustomDecode1(t: &testing::T) {
mut b := []byte("false")
mut a := abc(-1)
Decode(b, a) else {
t.Errorf("want 0, throwed exception")
t.Errorf("want 0, threw exception")
a = 0
}
if a != 0 {
Expand All @@ -251,7 +251,7 @@ fn testCustomDecode1(t: &testing::T) {
a = -1
b = []byte("true")
Decode(b, a) else {
t.Errorf("want 1, throwed exception")
t.Errorf("want 1, threw exception")
a = 1
}
if a != 1 {
Expand All @@ -264,7 +264,7 @@ fn testCustomDecode2(t: &testing::T) {
mut b := []byte("false")
mut a := abc2(new(int, -1))
Decode(b, a) else {
t.Errorf("want 0, throwed exception")
t.Errorf("want 0, threw exception")
*a = 0
}
if *a != 0 {
Expand All @@ -273,7 +273,7 @@ fn testCustomDecode2(t: &testing::T) {
*a = -1
b = []byte("true")
Decode(b, a) else {
t.Errorf("want 1, throwed exception")
t.Errorf("want 1, threw exception")
*a = 1
}
if *a != 1 {
Expand All @@ -286,7 +286,7 @@ fn testCustomDecode3(t: &testing::T) {
mut b := []byte("false")
mut a := new(abc2, new(int, -1))
Decode(b, a) else {
t.Errorf("want 0, throwed exception")
t.Errorf("want 0, threw exception")
**a = 0
}
if **a != 0 {
Expand All @@ -295,7 +295,7 @@ fn testCustomDecode3(t: &testing::T) {
**a = -1
b = []byte("true")
Decode(b, a) else {
t.Errorf("want 1, throwed exception")
t.Errorf("want 1, threw exception")
**a = 1
}
if **a != 1 {
Expand Down
2 changes: 1 addition & 1 deletion std/encoding/json/encode.jule
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ impl jsonEncoder {
| comptime::Kind.SmartPtr:
// Avoid to implement as a function.
// Fills call stack faster especially with recursive structures.
// Handle smart pointers here quicky and forward to relevant encoder.
// Handle smart pointers here efficiently and forward to relevant encoder.
if t == nil {
self.encodeNil()
} else {
Expand Down
16 changes: 8 additions & 8 deletions std/encoding/json/encode_test.jule
Original file line number Diff line number Diff line change
Expand Up @@ -326,15 +326,15 @@ impl abc {
fn testCustomEncode(t: &testing::T) {
mut a := new(abc, 0)
mut r := Encode(a) else {
t.Errorf("want false, throwed exception")
t.Errorf("want false, threw exception")
use []byte("false")
}
if str(r) != "false" {
t.Errorf("want false, found {}", str(r))
}
*a = 1
r = Encode(a) else {
t.Errorf("want true, throwed exception")
t.Errorf("want true, threw exception")
use []byte("true")
}
if str(r) != "true" {
Expand All @@ -346,15 +346,15 @@ fn testCustomEncode(t: &testing::T) {
fn testCustomEncode1(t: &testing::T) {
mut a := abc(0)
mut r := Encode(a) else {
t.Errorf("want false, throwed exception")
t.Errorf("want false, threw exception")
use []byte("false")
}
if str(r) != "false" {
t.Errorf("want false, found {}", str(r))
}
a = 1
r = Encode(a) else {
t.Errorf("want true, throwed exception")
t.Errorf("want true, threw exception")
use []byte("true")
}
if str(r) != "true" {
Expand Down Expand Up @@ -390,15 +390,15 @@ impl abc2 {
fn testCustomEncode2(t: &testing::T) {
mut a := abc2(new(int, 0))
mut r := Encode(a) else {
t.Errorf("want false, throwed exception")
t.Errorf("want false, threw exception")
use []byte("false")
}
if str(r) != "false" {
t.Errorf("want false, found {}", str(r))
}
*a = 1
r = Encode(a) else {
t.Errorf("want true, throwed exception")
t.Errorf("want true, threw exception")
use []byte("true")
}
if str(r) != "true" {
Expand All @@ -410,15 +410,15 @@ fn testCustomEncode2(t: &testing::T) {
fn testCustomEncode3(t: &testing::T) {
mut a := new(abc2, new(int, 0))
mut r := Encode(a) else {
t.Errorf("want false, throwed exception")
t.Errorf("want false, threw exception")
use []byte("false")
}
if str(r) != "false" {
t.Errorf("want false, found {}", str(r))
}
**a = 1
r = Encode(a) else {
t.Errorf("want true, throwed exception")
t.Errorf("want true, threw exception")
use []byte("true")
}
if str(r) != "true" {
Expand Down
6 changes: 3 additions & 3 deletions std/internal/poll/fd_unix.jule
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ struct FD {
}

impl FD {
// Writes bytes to the file descriptor and returns writed byte count.
// Writes bytes to the file descriptor and returns written byte count.
// The number of bytes written can never exceed the length of the buf.
fn Write(mut self, buf: []byte): (n: int, ok: bool) {
if len(buf) == 0 {
Expand Down Expand Up @@ -84,8 +84,8 @@ impl FD {
ret
}

// Read bytes to buffer from the file descriptor and returns readed byte count.
// The number of bytes readed can never exceed the length of the buf.
// Read bytes to buffer from the file descriptor and returns read byte count.
// The number of bytes read can never exceed the length of the buf.
// If the buf is larger than the number of bytes that can be read,
// the buffer will not cause an overflow. Offset will be shifted
// by the number of bytes read.
Expand Down
10 changes: 5 additions & 5 deletions std/internal/poll/fd_windows.jule
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ struct FD {
}

impl FD {
// Writes bytes to the file descriptor and returns writed byte count.
// Writes bytes to the file descriptor and returns written byte count.
// The number of bytes written can never exceed the length of the buf.
fn Write(mut self, buf: []byte): (n: int, ok: bool) {
if len(buf) == 0 {
Expand Down Expand Up @@ -99,7 +99,7 @@ impl FD {
ret
}

// Writes buf to console handle, returns writed byte count.
// Writes buf to console handle, returns written byte count.
// Returns -1 if error occurred.
fn writeConsole(mut self, mut buf: []byte): (n: int) {
n = len(buf)
Expand Down Expand Up @@ -143,8 +143,8 @@ impl FD {
ret
}

// Read bytes to buffer from the file descriptor and returns readed byte count.
// The number of bytes readed can never exceed the length of the buf.
// Read bytes to buffer from the file descriptor and returns read byte count.
// The number of bytes read can never exceed the length of the buf.
// If the buf is larger than the number of bytes that can be read,
// the buffer will not cause an overflow. Offset will be shifted
// by the number of bytes read.
Expand Down Expand Up @@ -197,7 +197,7 @@ impl FD {
ret
}

// Reads from console handle into buf to console handle, returns readed byte count.
// Reads from console handle into buf to console handle, returns read byte count.
fn readConsole(mut self, mut buf: []byte): (n: int, ok: bool) {
if self.readu16 == nil {
// This information adopted from the Go programming language:
Expand Down
4 changes: 2 additions & 2 deletions std/jule/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ For example:
\
These packages are specially processed and treated differently than standard use declarations. These treatments only apply to supported packages. To see relevant treatments, see implicit imports section of the reference.\
\
Typical uses are things like capturing or tracing private behavior. For example, the reference Jule compiler may embed the `std/runtime` package for some special calls. The semantic analyzer makes the necessary private calls for this embedded package when necessary. For example, appends instance to array compare generic method for array comparions.
Typical uses are things like capturing or tracing private behavior. For example, the reference Jule compiler may embed the `std/runtime` package for some special calls. The semantic analyzer makes the necessary private calls for this embedded package when necessary. For example, appends instance to array compare generic method for array comparison.
- **(8.1)** The `Token` field is used to distinguish specific packages. If the `Token` field of the AST element is set to `nil`, the package built-in use declaration is considered. Accordingly, AST must always set the `Token` field for each use declaration which is not implicitly imported.
- **(8.2)** Semantic analyzer will ignore implicit use declaration for duplication analysis. So, built-in implicit imported packages may be duplicated if placed source file contains separate use declaration for the same package.
- **(8.3)** These packages should be placed as first use declarations of the main package's first file.
Expand All @@ -74,4 +74,4 @@ Here is the list of custom behaviors for this package;
- (1) `arrayCmp`: Developed to eliminate the need for the Jule compiler to generate code specifically for array comparisons for each backend and to reduce analysis cost. The semantic analyzer creates the necessary instance for this generic function when an array comparison is made. Thus, the necessary comparison function for each array is programmed at the Jule frontend level.
- (2): `toStr`: Built-in string conversion function for types. An instance is created in any situation that may be required.
- (3): `_Map`: Built-in map type implementation. An instance created for each unique map type declaration.
- (4): `pchan`: Built-in chan type implementation. An instance created for each unique channel type declaration.
- (4): `pchan`: Built-in chan type implementation. An instance created for each unique channel type declaration.
4 changes: 2 additions & 2 deletions std/jule/importer/importer.jule
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ impl sema::Importer for Importer {

fn GetImport(mut self, path: str): &sema::ImportInfo {
for (_, mut p) in self.pkgs {
// avoid case sensivity for fair comparison
// avoid case sensitivity for fair comparison
if strings::EqualFold(p.Path, path) {
ret p
}
Expand Down Expand Up @@ -141,7 +141,7 @@ impl sema::Importer for Importer {
fn Imported(mut self, mut imp: &sema::ImportInfo) {
// Already imported?
for _, p in self.pkgs {
// avoid case sensivity for fair comparison
// avoid case sensitivity for fair comparison
if p.Binded == imp.Binded && strings::EqualFold(p.Path, imp.Path) {
ret
}
Expand Down
2 changes: 1 addition & 1 deletion std/jule/sema/sema.jule
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ impl sema {
// The public and token parameters belongs to define which is accessed.
fn isAccessibleDefine(self, public: bool, token: &token::Token): bool {
if public || token.File == nil {
// defins is public or built-in
// public or built-in
ret true
}
selfDir := self.file.File.Dir()
Expand Down
2 changes: 1 addition & 1 deletion std/jule/sema/struct.jule
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ impl Struct {
}

// Appends instance if unique.
// Returns already exist instance if given insance is not unique.
// Returns already exist instance if given instance is not unique.
fn appendInstance(mut self, mut &ins: &StructIns): &StructIns {
// Skip already created instance for just one unique combination.
if len(self.Generics) == 0 && len(self.Instances) == 1 {
Expand Down
Loading
Loading