Skip to content

Commit baa3a79

Browse files
authored
Removed some #[allow(...)] s (#97)
* Also updated README and others
1 parent 0881454 commit baa3a79

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+571
-853
lines changed

.github/workflows/github-release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ jobs:
8383
mkdir artifacts
8484
mv target/release/ezno${{ matrix.executable-extension }} artifacts/ezno-${{ needs.get-build-info.outputs.new-ezno-version }}-${{ matrix.platform_name }}${{ matrix.executable-extension }}
8585
86-
- uses: actions/upload-artifact@v3
86+
- uses: actions/upload-artifact@v4
8787
with:
8888
name: build-artifacts
8989
path: artifacts/*

CONTRIBUTING.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,15 +48,16 @@ cargo run -p ezno-parser --example lex path/to/file.ts
4848
- Check source is valid with `cargo check --workspace`
4949
- Check that code is formatted in accordance with the specification with `cargo fmt --all --check`
5050
- Run all tests `cargo test --workspace --verbose`
51+
- Use `cargo clippy -- --allow warnings` to find blocking lints
5152

5253
### The notify! macro
5354

5455
The checker crate has the `crate::utils::notify!` macro, which can be used to trace information when the `EZNO_DEBUG` environment variable is set.
56+
5557
## *Rules* for contributions
5658

57-
- Won't merge PRs that introduce new errors. However will merge PRs which pick up or find existing issues
5859
- Code **must** be formatted with `cargo format` inline with the current format configuration
59-
- Use `cargo clippy` as guidance for design but warning lints are not a blocker
60+
- It **must** pass `cargo clippy -- --allow warnings`. In many cases adding `allow` to items is fine
6061

6162
## Oxc
6263

README.md

Lines changed: 17 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,30 @@
11
A JavaScript compiler and TypeScript checker written in Rust with a focus on static analysis and runtime performance.
22

3-
You can *try* what it current [supports today](./checker/specification/specification.md) with `npx`
3+
> [!IMPORTANT]
4+
> Ezno is in active development and **currently does not support enough features to check existing projects**. Check out the [getting started guide](./checker/docs/getting-started.md) for experimenting with what it current [supports today](./checker/specification/specification.md).
45
5-
```shell
6-
npx ezno check file.ts
7-
```
8-
9-
Or download the binary with `npm install ezno`, `cargo install ezno` or on [GitHub releases](https://github.com/kaleidawave/ezno/releases). [Or try it in Oxc](https://gist.github.com/kaleidawave/5dcb9ec03deef1161ebf0c9d6e4b88d8)!
6+
Read about Ezno
7+
- [Introducing Ezno](https://kaleidawave.github.io/posts/introducing-ezno/)
8+
- [Ezno in '23](https://kaleidawave.github.io/posts/ezno-23/)
9+
- [A preview of the checker](https://kaleidawave.github.io/posts/a-preview-of-the-checker/)
1010

11-
![project lines of code](https://projects.kaleidawave.workers.dev/project/ezno/badge)
11+
<!-- Currently out ![project lines of code](https://projects.kaleidawave.workers.dev/project/ezno/badge) -->
1212

1313
What Ezno is
1414
- A type checker for JavaScript, usable as a library or with *optional* compiler infrastructure (parser, CLI, LSP, etc)
15-
- Fully typed programs, guaranteeing type safety (as long as definitions are sound)
15+
- Fully typed programs with guaranteed type safety (as long as definitions are sound)
1616
- Types aimed at soundness and tracing for better static analysis
17-
- A *imperative* type system, with event tracing and evaluating function side effects. Equivalent to an interpreter, but with types rather than values
18-
- A collection of experiments of types. Some features work well, others are in the prototype stage. Some are specific to JavaScript, others could be applied to other dynamic languages
19-
- A challenge to the status quo of DCE, type checking and compilation through deeper static analysis beyond syntax analysis
17+
- A *imperative* type system that tracks and evaluates the side effects of functions and control flow structures. It is similar to an interpreter, but acts with types instead of *values*
18+
- A collection of experiments of types. Many are being worked out and are in the prototype stage. Some of the new behaviors benefit JavaScript specifically and others could be applied to other languages
19+
- A challenge to the status quo of type checking, optimisations and compilation through deeper static analysis beyond syntax analysis
20+
- [A high level library](https://docs.rs/ezno-checker/latest/ezno_checker/) that allows [type checking to be added to other tools!](https://github.com/web-infra-dev/oxc/tree/main/crates/oxc_type_synthesis)
2021
- Written in Rust
22+
- [**Efficient**](https://kaleidawave.github.io/posts/a-preview-of-the-checker/#checking-performance)
2123

2224
What Ezno is not
23-
- **eNZo, Z goes before the N** (pronounce as 'Fresno' without the 'fr') 😀
24-
- 1:1 / parity with TSC, it has different behaviors **but** should work in existing projects using TSC (check out [stc](https://github.com/dudykr/stc) that is aimed at 1:1)
25-
- A binary executable generator. It takes in JavaScript (or TS/Ezno superset) and does similar methods to traditional compilers, but at the end emits JavaScript. However the event intermediate representation could be used in the future to generate a lower level format
26-
- Usable, [still a way to go until it can check actual programs](https://github.com/kaleidawave/ezno/milestone/1). See the [specification](./checker/specification/specification.md) for what is currently implemented in the checker
27-
28-
Read some more detailed posts
29-
- [Introducing Ezno](https://kaleidawave.github.io/posts/introducing-ezno/)
30-
- [Ezno '23](https://kaleidawave.github.io/posts/ezno-23/)
31-
- [A preview of the checker](https://kaleidawave.github.io/posts/a-preview-of-the-checker/)
25+
- **eNZo, the Z is in front of the N** (pronounce as 'Fresno' without the 'fr') 😀
26+
- Be on parity with TSC or 1:1, it has some different behaviors **but** should work in existing projects using TSC (check out [stc](https://github.com/dudykr/stc) that is written in Rust and is aimed at replicating TSC)
27+
- A binary executable generator. It takes in JavaScript (or a TypeScript or Ezno superset) and does similar processes to traditional compilers, but at the end emits JavaScript. However in the future it could generate a lower level format using its event representation
3228

3329
---
3430

@@ -41,7 +37,7 @@ This project is a workspace consisting of a few crates:
4137
<!-- | ezno-web-framework | ![](https://projects.kaleidawave.workers.dev/project/framework/badge) | Visitors and code generation for JSX and reactive expression transformations. | -->
4238
<!-- | ezno-lsp | ![](https://projects.kaleidawave.workers.dev/project/framework/badge) | Visitors and code generation for JSX and reactive expression transformations. | -->
4339

44-
Also checkout [oxc_type_synthesis](https://github.com/web-infra-dev/oxc/tree/main/crates/oxc_type_synthesis), a crate which allows using the type checker through [oxc](https://github.com/web-infra-dev/oxc/tree/main)!
40+
Also checkout [oxc_type_synthesis](https://github.com/web-infra-dev/oxc/tree/main/crates/oxc_type_synthesis), a crate which allows using the type checker inside [oxc](https://github.com/web-infra-dev/oxc/tree/main)!
4541

4642
## Help contribute
4743

checker/docs/getting-started.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
Ezno is work in progress. It doesn't currently support all the features of JavaScript and TypeScript **but** it has a fairly large [specification of features that it supports today](../specification/specification.md). While it isn't worth it trying it on existing codebases ATM as it likely will blow up. You can try out the snippets in the specification and other small pieces of code today.
2+
3+
You can try the `check` command of ezno using `npx`
4+
5+
```shell
6+
npx ezno check file.ts
7+
```
8+
9+
Or download the binary with `npm install ezno`, `cargo install ezno` or on [GitHub releases](https://github.com/kaleidawave/ezno/releases).
10+
11+
You can use the `print_type` function to see the type of expressions.
12+
13+
```tsx
14+
const x = 6;
15+
print_type(x + 8)
16+
```
17+
18+
If you find any unexpected exceptions, please leave an issue 😁

checker/specification/specification.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
## Specification
22

3-
See [./README.md](README.md) for details
3+
See [./README.md](README.md) for details about how `specification.md` works
44

55
### Variables
66

checker/src/behavior/assignments.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
use source_map::{Span, SpanWithSource};
1+
use source_map::SpanWithSource;
22

3-
use crate::{
4-
context::facts::Publicity, types::properties::PropertyKey, CheckingData, Environment, TypeId,
5-
};
3+
use crate::{context::facts::Publicity, types::properties::PropertyKey, TypeId};
64

75
use super::operations::{Logical, MathematicalAndBitwise};
86

checker/src/behavior/constant_functions.rs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
1-
use source_map::{Span, SpanWithSource};
1+
use source_map::SpanWithSource;
22

33
use crate::{
44
context::get_on_ctx,
55
subtyping::check_satisfies,
6-
types::{
7-
functions::SynthesisedArgument, poly_types::generic_type_arguments::TypeArgumentStore,
8-
printing::debug_effects,
9-
},
10-
types::{poly_types::FunctionTypeArguments, printing::print_type, Type, TypeStore},
6+
types::{functions::SynthesisedArgument, printing::debug_effects},
7+
types::{printing::print_type, Type, TypeStore},
118
Constant, Environment, TypeId,
129
};
1310

@@ -181,7 +178,7 @@ pub(crate) fn call_constant_function(
181178
}
182179
"set_prototype" => {
183180
if let [first, second] = arguments {
184-
let prototype = environment
181+
let _prototype = environment
185182
.facts
186183
.prototypes
187184
.insert(first.to_type().unwrap(), second.to_type().unwrap());

checker/src/behavior/functions.rs

Lines changed: 22 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,14 @@ use std::{
44
mem,
55
};
66

7-
use source_map::{SourceId, Span, SpanWithSource};
7+
use source_map::{SourceId, SpanWithSource};
88

9-
use super::variables::VariableMutability;
109
use crate::{
1110
context::{
12-
environment::FunctionScope,
13-
facts::{Facts, Publicity},
14-
get_value_of_variable, CanReferenceThis, Context, ContextType, Syntax,
11+
environment::FunctionScope, facts::Facts, get_value_of_variable, CanReferenceThis,
12+
ContextType, Syntax,
1513
},
16-
events::{Event, RootReference},
14+
events::RootReference,
1715
types::{
1816
self,
1917
classes::ClassValue,
@@ -22,8 +20,7 @@ use crate::{
2220
properties::{PropertyKey, PropertyValue},
2321
Constructor, FunctionType, PolyNature, TypeStore,
2422
},
25-
ASTImplementation, CheckingData, Environment, FunctionId, ReadFromFS, Scope, Type, TypeId,
26-
VariableId,
23+
CheckingData, Environment, FunctionId, ReadFromFS, Scope, Type, TypeId, VariableId,
2724
};
2825

2926
#[derive(Clone, Copy, Debug, Default, binary_serialize_derive::BinarySerializable)]
@@ -307,10 +304,10 @@ where
307304
A: crate::ASTImplementation,
308305
F: SynthesisableFunction<A>,
309306
{
310-
let is_async = behavior.is_async();
311-
let is_generator = behavior.is_generator();
307+
let _is_async = behavior.is_async();
308+
let _is_generator = behavior.is_generator();
312309

313-
let (mut behavior, scope, constructor, location, expected_parameters, expected_return) =
310+
let (mut behavior, scope, constructor, location, expected_parameters, _expected_return) =
314311
match behavior {
315312
FunctionRegisterBehavior::Constructor { super_type, prototype, properties } => (
316313
FunctionBehavior::Constructor {
@@ -350,7 +347,7 @@ where
350347
)
351348
}
352349
FunctionRegisterBehavior::ExpressionFunction {
353-
expecting,
350+
expecting: _,
354351
is_async,
355352
is_generator,
356353
location,
@@ -373,7 +370,7 @@ where
373370
None,
374371
),
375372
FunctionRegisterBehavior::StatementFunction {
376-
hoisted,
373+
hoisted: _,
377374
is_async,
378375
is_generator,
379376
location,
@@ -394,23 +391,8 @@ where
394391
None,
395392
None,
396393
),
397-
FunctionRegisterBehavior::ObjectMethod { is_async, is_generator } => (
398-
FunctionBehavior::Method {
399-
is_async,
400-
is_generator,
401-
free_this_id: TypeId::ERROR_TYPE,
402-
},
403-
FunctionScope::MethodFunction {
404-
free_this_type: TypeId::ERROR_TYPE,
405-
is_async,
406-
is_generator,
407-
},
408-
None,
409-
None,
410-
None,
411-
None,
412-
),
413-
FunctionRegisterBehavior::ClassMethod { is_async, is_generator, super_type } => (
394+
FunctionRegisterBehavior::ClassMethod { is_async, is_generator, super_type: _ }
395+
| FunctionRegisterBehavior::ObjectMethod { is_async, is_generator } => (
414396
FunctionBehavior::Method {
415397
is_async,
416398
is_generator,
@@ -510,7 +492,11 @@ where
510492
// TODO what is the union, shouldn't it be the this_constraint?
511493
*this_type = new_conditional_type;
512494
}
513-
FunctionScope::Constructor { extends, type_of_super, ref mut this_object_type } => {
495+
FunctionScope::Constructor {
496+
extends: _,
497+
type_of_super: _,
498+
ref mut this_object_type,
499+
} => {
514500
crate::utils::notify!("Setting 'this' type here");
515501
if let Some((prototype, properties)) = constructor {
516502
let new_this_object_type = types::create_this_before_function_synthesis(
@@ -558,7 +544,7 @@ where
558544
let returned = if function.has_body() {
559545
function.body(&mut function_environment, checking_data);
560546
// Temporary move events to satisfy borrow checker
561-
let mut events = mem::take(&mut function_environment.facts.events);
547+
let events = mem::take(&mut function_environment.facts.events);
562548

563549
let returned = crate::events::helpers::get_return_from_events(
564550
&mut events.iter(),
@@ -612,18 +598,18 @@ where
612598
context.variable_names.extend(function_environment.variable_names);
613599

614600
// TODO temp ...
615-
for (on, mut properties) in facts.current_properties {
601+
for (on, properties) in facts.current_properties {
616602
match context.facts.current_properties.entry(on) {
617-
Entry::Occupied(mut occupied) => {}
603+
Entry::Occupied(_occupied) => {}
618604
Entry::Vacant(vacant) => {
619605
vacant.insert(properties);
620606
}
621607
}
622608
}
623609

624-
for (on, mut properties) in facts.closure_current_values {
610+
for (on, properties) in facts.closure_current_values {
625611
match context.facts.closure_current_values.entry(on) {
626-
Entry::Occupied(mut occupied) => {}
612+
Entry::Occupied(_occupied) => {}
627613
Entry::Vacant(vacant) => {
628614
vacant.insert(properties);
629615
}

0 commit comments

Comments
 (0)