-
-
Notifications
You must be signed in to change notification settings - Fork 56
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
Add some units #288
Add some units #288
Conversation
@name("Rack unit") | ||
@url("https://en.wikipedia.org/wiki/Rack_unit") | ||
@aliases(rackunits, RU: short, U: short) | ||
unit rackunit: Length = 0.04445 meter |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I want to use 1.75 inch
, but this causes cargo run --example=inspect
to fail (even when I have use si::imperial
):
Finished dev [unoptimized + debuginfo] target(s) in 0.27s
Running `target/debug/examples/inspect`
thread 'main' panicked at numbat/examples/inspect.rs:11:66:
called `Result::unwrap()` on an `Err` value: TypeCheckError(UnknownIdentifier(Span { start: SourceCodePositition { byte: 3266, line: 117, position: 30 }, end: SourceCodePositition { byte: 3270, line: 117, position: 34 }, code_source_id: 16 }, "inch", None))
stack backtrace:
0: rust_begin_unwind
1: core::panicking::panic_fmt
2: core::result::unwrap_failed
3: core::result::Result<T,E>::unwrap
at /builddir/rust-1.74.0/library/core/src/result.rs:1077:23
4: inspect::main
at ./numbat/examples/inspect.rs:11:19
5: core::ops::function::FnOnce::call_once
at /builddir/rust-1.74.0/library/core/src/ops/function.rs:250:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe there's a problem with a circular dependency: imperial.nbt depends on misc.nbt, so adding a dependency from misc.nbt back to imperial might cause a problem?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe there's a problem with a circular dependency
That's it. We currently 'tolerate' cyclic dependencies:
Lines 263 to 275 in cb1c6be
#[test] | |
fn resolved_cyclic_imports() { | |
let program = " | |
use cycle_a | |
"; | |
let importer = TestImporter {}; | |
let mut resolver = Resolver::new(importer); | |
let program_inlined = resolver.resolve(program, CodeSource::Internal).unwrap(); | |
assert_eq!(&program_inlined, &[]); | |
} |
But we should probably show an error instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For this PR, let's go with what you have, @mhmdanas. Another option would be to split this module into multiple pieces. But we can do this in a follow-up.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you
No description provided.