Compare commits
4 Commits
v1.0.2
...
achalmers/
Author | SHA1 | Date | |
---|---|---|---|
cc07400719 | |||
5fccaad0e7 | |||
a506f7f698 | |||
1bb96cd878 |
20
rust/Cargo.lock
generated
20
rust/Cargo.lock
generated
@ -1815,7 +1815,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "kcl-bumper"
|
name = "kcl-bumper"
|
||||||
version = "0.1.77"
|
version = "0.1.78"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"clap",
|
"clap",
|
||||||
@ -1826,7 +1826,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "kcl-derive-docs"
|
name = "kcl-derive-docs"
|
||||||
version = "0.1.77"
|
version = "0.1.78"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"Inflector",
|
"Inflector",
|
||||||
"anyhow",
|
"anyhow",
|
||||||
@ -1845,7 +1845,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "kcl-directory-test-macro"
|
name = "kcl-directory-test-macro"
|
||||||
version = "0.1.77"
|
version = "0.1.78"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"convert_case",
|
"convert_case",
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
@ -1855,7 +1855,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "kcl-language-server"
|
name = "kcl-language-server"
|
||||||
version = "0.2.77"
|
version = "0.2.78"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"clap",
|
"clap",
|
||||||
@ -1876,7 +1876,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "kcl-language-server-release"
|
name = "kcl-language-server-release"
|
||||||
version = "0.1.77"
|
version = "0.1.78"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"clap",
|
"clap",
|
||||||
@ -1896,7 +1896,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "kcl-lib"
|
name = "kcl-lib"
|
||||||
version = "0.2.77"
|
version = "0.2.78"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"approx 0.5.1",
|
"approx 0.5.1",
|
||||||
@ -1973,7 +1973,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "kcl-python-bindings"
|
name = "kcl-python-bindings"
|
||||||
version = "0.3.77"
|
version = "0.3.78"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"kcl-lib",
|
"kcl-lib",
|
||||||
@ -1988,7 +1988,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "kcl-test-server"
|
name = "kcl-test-server"
|
||||||
version = "0.1.77"
|
version = "0.1.78"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"hyper 0.14.32",
|
"hyper 0.14.32",
|
||||||
@ -2001,7 +2001,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "kcl-to-core"
|
name = "kcl-to-core"
|
||||||
version = "0.1.77"
|
version = "0.1.78"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"async-trait",
|
"async-trait",
|
||||||
@ -2015,7 +2015,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "kcl-wasm-lib"
|
name = "kcl-wasm-lib"
|
||||||
version = "0.1.77"
|
version = "0.1.78"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"bson",
|
"bson",
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
[package]
|
[package]
|
||||||
name = "kcl-bumper"
|
name = "kcl-bumper"
|
||||||
version = "0.1.77"
|
version = "0.1.78"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
repository = "https://github.com/KittyCAD/modeling-api"
|
repository = "https://github.com/KittyCAD/modeling-api"
|
||||||
rust-version = "1.76"
|
rust-version = "1.76"
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "kcl-derive-docs"
|
name = "kcl-derive-docs"
|
||||||
description = "A tool for generating documentation from Rust derive macros"
|
description = "A tool for generating documentation from Rust derive macros"
|
||||||
version = "0.1.77"
|
version = "0.1.78"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
repository = "https://github.com/KittyCAD/modeling-app"
|
repository = "https://github.com/KittyCAD/modeling-app"
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "kcl-directory-test-macro"
|
name = "kcl-directory-test-macro"
|
||||||
description = "A tool for generating tests from a directory of kcl files"
|
description = "A tool for generating tests from a directory of kcl files"
|
||||||
version = "0.1.77"
|
version = "0.1.78"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
repository = "https://github.com/KittyCAD/modeling-app"
|
repository = "https://github.com/KittyCAD/modeling-app"
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "kcl-language-server-release"
|
name = "kcl-language-server-release"
|
||||||
version = "0.1.77"
|
version = "0.1.78"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
authors = ["KittyCAD Inc <kcl@kittycad.io>"]
|
authors = ["KittyCAD Inc <kcl@kittycad.io>"]
|
||||||
publish = false
|
publish = false
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
name = "kcl-language-server"
|
name = "kcl-language-server"
|
||||||
description = "A language server for KCL."
|
description = "A language server for KCL."
|
||||||
authors = ["KittyCAD Inc <kcl@kittycad.io>"]
|
authors = ["KittyCAD Inc <kcl@kittycad.io>"]
|
||||||
version = "0.2.77"
|
version = "0.2.78"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "kcl-lib"
|
name = "kcl-lib"
|
||||||
description = "KittyCAD Language implementation and tools"
|
description = "KittyCAD Language implementation and tools"
|
||||||
version = "0.2.77"
|
version = "0.2.78"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
repository = "https://github.com/KittyCAD/modeling-app"
|
repository = "https://github.com/KittyCAD/modeling-app"
|
||||||
|
@ -107,8 +107,11 @@ pub enum KclError {
|
|||||||
Unexpected(KclErrorDetails),
|
Unexpected(KclErrorDetails),
|
||||||
#[error("value already defined: {0:?}")]
|
#[error("value already defined: {0:?}")]
|
||||||
ValueAlreadyDefined(KclErrorDetails),
|
ValueAlreadyDefined(KclErrorDetails),
|
||||||
#[error("undefined value: {0:?}")]
|
#[error("undefined value: {details:?}")]
|
||||||
UndefinedValue(KclErrorDetails),
|
UndefinedValue {
|
||||||
|
details: KclErrorDetails,
|
||||||
|
undefined_name: Option<String>,
|
||||||
|
},
|
||||||
#[error("invalid expression: {0:?}")]
|
#[error("invalid expression: {0:?}")]
|
||||||
InvalidExpression(KclErrorDetails),
|
InvalidExpression(KclErrorDetails),
|
||||||
#[error("engine: {0:?}")]
|
#[error("engine: {0:?}")]
|
||||||
@ -304,7 +307,7 @@ impl miette::Diagnostic for ReportWithOutputs {
|
|||||||
KclError::Io(_) => "I/O",
|
KclError::Io(_) => "I/O",
|
||||||
KclError::Unexpected(_) => "Unexpected",
|
KclError::Unexpected(_) => "Unexpected",
|
||||||
KclError::ValueAlreadyDefined(_) => "ValueAlreadyDefined",
|
KclError::ValueAlreadyDefined(_) => "ValueAlreadyDefined",
|
||||||
KclError::UndefinedValue(_) => "UndefinedValue",
|
KclError::UndefinedValue { .. } => "UndefinedValue",
|
||||||
KclError::InvalidExpression(_) => "InvalidExpression",
|
KclError::InvalidExpression(_) => "InvalidExpression",
|
||||||
KclError::Engine(_) => "Engine",
|
KclError::Engine(_) => "Engine",
|
||||||
KclError::Internal(_) => "Internal",
|
KclError::Internal(_) => "Internal",
|
||||||
@ -354,7 +357,7 @@ impl miette::Diagnostic for Report {
|
|||||||
KclError::Io(_) => "I/O",
|
KclError::Io(_) => "I/O",
|
||||||
KclError::Unexpected(_) => "Unexpected",
|
KclError::Unexpected(_) => "Unexpected",
|
||||||
KclError::ValueAlreadyDefined(_) => "ValueAlreadyDefined",
|
KclError::ValueAlreadyDefined(_) => "ValueAlreadyDefined",
|
||||||
KclError::UndefinedValue(_) => "UndefinedValue",
|
KclError::UndefinedValue { .. } => "UndefinedValue",
|
||||||
KclError::InvalidExpression(_) => "InvalidExpression",
|
KclError::InvalidExpression(_) => "InvalidExpression",
|
||||||
KclError::Engine(_) => "Engine",
|
KclError::Engine(_) => "Engine",
|
||||||
KclError::Internal(_) => "Internal",
|
KclError::Internal(_) => "Internal",
|
||||||
@ -432,7 +435,7 @@ impl KclError {
|
|||||||
KclError::Io(_) => "i/o",
|
KclError::Io(_) => "i/o",
|
||||||
KclError::Unexpected(_) => "unexpected",
|
KclError::Unexpected(_) => "unexpected",
|
||||||
KclError::ValueAlreadyDefined(_) => "value already defined",
|
KclError::ValueAlreadyDefined(_) => "value already defined",
|
||||||
KclError::UndefinedValue(_) => "undefined value",
|
KclError::UndefinedValue { .. } => "undefined value",
|
||||||
KclError::InvalidExpression(_) => "invalid expression",
|
KclError::InvalidExpression(_) => "invalid expression",
|
||||||
KclError::Engine(_) => "engine",
|
KclError::Engine(_) => "engine",
|
||||||
KclError::Internal(_) => "internal",
|
KclError::Internal(_) => "internal",
|
||||||
@ -449,7 +452,7 @@ impl KclError {
|
|||||||
KclError::Io(e) => e.source_ranges.clone(),
|
KclError::Io(e) => e.source_ranges.clone(),
|
||||||
KclError::Unexpected(e) => e.source_ranges.clone(),
|
KclError::Unexpected(e) => e.source_ranges.clone(),
|
||||||
KclError::ValueAlreadyDefined(e) => e.source_ranges.clone(),
|
KclError::ValueAlreadyDefined(e) => e.source_ranges.clone(),
|
||||||
KclError::UndefinedValue(e) => e.source_ranges.clone(),
|
KclError::UndefinedValue { details, .. } => details.source_ranges.clone(),
|
||||||
KclError::InvalidExpression(e) => e.source_ranges.clone(),
|
KclError::InvalidExpression(e) => e.source_ranges.clone(),
|
||||||
KclError::Engine(e) => e.source_ranges.clone(),
|
KclError::Engine(e) => e.source_ranges.clone(),
|
||||||
KclError::Internal(e) => e.source_ranges.clone(),
|
KclError::Internal(e) => e.source_ranges.clone(),
|
||||||
@ -467,7 +470,7 @@ impl KclError {
|
|||||||
KclError::Io(e) => &e.message,
|
KclError::Io(e) => &e.message,
|
||||||
KclError::Unexpected(e) => &e.message,
|
KclError::Unexpected(e) => &e.message,
|
||||||
KclError::ValueAlreadyDefined(e) => &e.message,
|
KclError::ValueAlreadyDefined(e) => &e.message,
|
||||||
KclError::UndefinedValue(e) => &e.message,
|
KclError::UndefinedValue { details, .. } => &details.message,
|
||||||
KclError::InvalidExpression(e) => &e.message,
|
KclError::InvalidExpression(e) => &e.message,
|
||||||
KclError::Engine(e) => &e.message,
|
KclError::Engine(e) => &e.message,
|
||||||
KclError::Internal(e) => &e.message,
|
KclError::Internal(e) => &e.message,
|
||||||
@ -484,7 +487,7 @@ impl KclError {
|
|||||||
| KclError::Io(e)
|
| KclError::Io(e)
|
||||||
| KclError::Unexpected(e)
|
| KclError::Unexpected(e)
|
||||||
| KclError::ValueAlreadyDefined(e)
|
| KclError::ValueAlreadyDefined(e)
|
||||||
| KclError::UndefinedValue(e)
|
| KclError::UndefinedValue { details: e, .. }
|
||||||
| KclError::InvalidExpression(e)
|
| KclError::InvalidExpression(e)
|
||||||
| KclError::Engine(e)
|
| KclError::Engine(e)
|
||||||
| KclError::Internal(e) => e.backtrace.clone(),
|
| KclError::Internal(e) => e.backtrace.clone(),
|
||||||
@ -502,7 +505,7 @@ impl KclError {
|
|||||||
| KclError::Io(e)
|
| KclError::Io(e)
|
||||||
| KclError::Unexpected(e)
|
| KclError::Unexpected(e)
|
||||||
| KclError::ValueAlreadyDefined(e)
|
| KclError::ValueAlreadyDefined(e)
|
||||||
| KclError::UndefinedValue(e)
|
| KclError::UndefinedValue { details: e, .. }
|
||||||
| KclError::InvalidExpression(e)
|
| KclError::InvalidExpression(e)
|
||||||
| KclError::Engine(e)
|
| KclError::Engine(e)
|
||||||
| KclError::Internal(e) => {
|
| KclError::Internal(e) => {
|
||||||
@ -531,7 +534,7 @@ impl KclError {
|
|||||||
| KclError::Io(e)
|
| KclError::Io(e)
|
||||||
| KclError::Unexpected(e)
|
| KclError::Unexpected(e)
|
||||||
| KclError::ValueAlreadyDefined(e)
|
| KclError::ValueAlreadyDefined(e)
|
||||||
| KclError::UndefinedValue(e)
|
| KclError::UndefinedValue { details: e, .. }
|
||||||
| KclError::InvalidExpression(e)
|
| KclError::InvalidExpression(e)
|
||||||
| KclError::Engine(e)
|
| KclError::Engine(e)
|
||||||
| KclError::Internal(e) => {
|
| KclError::Internal(e) => {
|
||||||
@ -555,7 +558,7 @@ impl KclError {
|
|||||||
| KclError::Io(e)
|
| KclError::Io(e)
|
||||||
| KclError::Unexpected(e)
|
| KclError::Unexpected(e)
|
||||||
| KclError::ValueAlreadyDefined(e)
|
| KclError::ValueAlreadyDefined(e)
|
||||||
| KclError::UndefinedValue(e)
|
| KclError::UndefinedValue { details: e, .. }
|
||||||
| KclError::InvalidExpression(e)
|
| KclError::InvalidExpression(e)
|
||||||
| KclError::Engine(e)
|
| KclError::Engine(e)
|
||||||
| KclError::Internal(e) => {
|
| KclError::Internal(e) => {
|
||||||
|
@ -164,10 +164,13 @@ impl ExecutorContext {
|
|||||||
let mut mod_value = mem.get_from(&mod_name, env_ref, import_item.into(), 0).cloned();
|
let mut mod_value = mem.get_from(&mod_name, env_ref, import_item.into(), 0).cloned();
|
||||||
|
|
||||||
if value.is_err() && ty.is_err() && mod_value.is_err() {
|
if value.is_err() && ty.is_err() && mod_value.is_err() {
|
||||||
return Err(KclError::UndefinedValue(KclErrorDetails::new(
|
return Err(KclError::UndefinedValue {
|
||||||
format!("{} is not defined in module", import_item.name.name),
|
undefined_name: None,
|
||||||
vec![SourceRange::from(&import_item.name)],
|
details: KclErrorDetails::new(
|
||||||
)));
|
format!("{} is not defined in module", import_item.name.name),
|
||||||
|
vec![SourceRange::from(&import_item.name)],
|
||||||
|
),
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check that the item is allowed to be imported (in at least one namespace).
|
// Check that the item is allowed to be imported (in at least one namespace).
|
||||||
@ -301,6 +304,7 @@ impl ExecutorContext {
|
|||||||
|
|
||||||
let annotations = &variable_declaration.outer_attrs;
|
let annotations = &variable_declaration.outer_attrs;
|
||||||
|
|
||||||
|
exec_state.mod_local.being_declared = Some(variable_declaration.inner.name().to_owned());
|
||||||
let value = self
|
let value = self
|
||||||
.execute_expr(
|
.execute_expr(
|
||||||
&variable_declaration.declaration.init,
|
&variable_declaration.declaration.init,
|
||||||
@ -310,6 +314,7 @@ impl ExecutorContext {
|
|||||||
StatementKind::Declaration { name: &var_name },
|
StatementKind::Declaration { name: &var_name },
|
||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
|
exec_state.mod_local.being_declared = None;
|
||||||
exec_state
|
exec_state
|
||||||
.mut_stack()
|
.mut_stack()
|
||||||
.add(var_name.clone(), value.clone(), source_range)?;
|
.add(var_name.clone(), value.clone(), source_range)?;
|
||||||
@ -635,7 +640,23 @@ impl ExecutorContext {
|
|||||||
Expr::Literal(literal) => KclValue::from_literal((**literal).clone(), exec_state),
|
Expr::Literal(literal) => KclValue::from_literal((**literal).clone(), exec_state),
|
||||||
Expr::TagDeclarator(tag) => tag.execute(exec_state).await?,
|
Expr::TagDeclarator(tag) => tag.execute(exec_state).await?,
|
||||||
Expr::Name(name) => {
|
Expr::Name(name) => {
|
||||||
let value = name.get_result(exec_state, self).await?.clone();
|
let being_declared = exec_state.mod_local.being_declared.clone();
|
||||||
|
let value = name
|
||||||
|
.get_result(exec_state, self)
|
||||||
|
.await
|
||||||
|
.map_err(|e| match e {
|
||||||
|
KclError::UndefinedValue {
|
||||||
|
undefined_name,
|
||||||
|
mut details,
|
||||||
|
} => {
|
||||||
|
if let Some(being_declared) = &being_declared{
|
||||||
|
details.message = format!("You can't use `{}` because you're currently trying to define it. Use a different variable here instead.", being_declared);
|
||||||
|
}
|
||||||
|
KclError::UndefinedValue { details, undefined_name}
|
||||||
|
}
|
||||||
|
e => e,
|
||||||
|
})?
|
||||||
|
.clone();
|
||||||
if let KclValue::Module { value: module_id, meta } = value {
|
if let KclValue::Module { value: module_id, meta } = value {
|
||||||
self.exec_module_for_result(
|
self.exec_module_for_result(
|
||||||
module_id,
|
module_id,
|
||||||
@ -913,10 +934,13 @@ impl Node<MemberExpression> {
|
|||||||
if let Some(value) = map.get(&property) {
|
if let Some(value) = map.get(&property) {
|
||||||
Ok(value.to_owned())
|
Ok(value.to_owned())
|
||||||
} else {
|
} else {
|
||||||
Err(KclError::UndefinedValue(KclErrorDetails::new(
|
Err(KclError::UndefinedValue {
|
||||||
format!("Property '{property}' not found in object"),
|
undefined_name: None,
|
||||||
vec![self.clone().into()],
|
details: KclErrorDetails::new(
|
||||||
)))
|
format!("Property '{property}' not found in object"),
|
||||||
|
vec![self.clone().into()],
|
||||||
|
),
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
(KclValue::Object { .. }, Property::String(property), true) => {
|
(KclValue::Object { .. }, Property::String(property), true) => {
|
||||||
@ -938,10 +962,13 @@ impl Node<MemberExpression> {
|
|||||||
if let Some(value) = value_of_arr {
|
if let Some(value) = value_of_arr {
|
||||||
Ok(value.to_owned())
|
Ok(value.to_owned())
|
||||||
} else {
|
} else {
|
||||||
Err(KclError::UndefinedValue(KclErrorDetails::new(
|
Err(KclError::UndefinedValue {
|
||||||
format!("The array doesn't have any item at index {index}"),
|
undefined_name: None,
|
||||||
vec![self.clone().into()],
|
details: KclErrorDetails::new(
|
||||||
)))
|
format!("The array doesn't have any item at index {index}"),
|
||||||
|
vec![self.clone().into()],
|
||||||
|
),
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Singletons and single-element arrays should be interchangeable, but only indexing by 0 should work.
|
// Singletons and single-element arrays should be interchangeable, but only indexing by 0 should work.
|
||||||
|
@ -318,10 +318,13 @@ impl Node<CallExpressionKw> {
|
|||||||
if let KclValue::Function { meta, .. } = func {
|
if let KclValue::Function { meta, .. } = func {
|
||||||
source_ranges = meta.iter().map(|m| m.source_range).collect();
|
source_ranges = meta.iter().map(|m| m.source_range).collect();
|
||||||
};
|
};
|
||||||
KclError::UndefinedValue(KclErrorDetails::new(
|
KclError::UndefinedValue {
|
||||||
format!("Result of user-defined function {} is undefined", fn_name),
|
undefined_name: None,
|
||||||
source_ranges,
|
details: KclErrorDetails::new(
|
||||||
))
|
format!("Result of user-defined function {} is undefined", fn_name),
|
||||||
|
source_ranges,
|
||||||
|
),
|
||||||
|
}
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
Ok(result)
|
Ok(result)
|
||||||
|
@ -367,10 +367,10 @@ impl ProgramMemory {
|
|||||||
|
|
||||||
let name = var.trim_start_matches(TYPE_PREFIX).trim_start_matches(MODULE_PREFIX);
|
let name = var.trim_start_matches(TYPE_PREFIX).trim_start_matches(MODULE_PREFIX);
|
||||||
|
|
||||||
Err(KclError::UndefinedValue(KclErrorDetails::new(
|
Err(KclError::UndefinedValue {
|
||||||
format!("`{name}` is not defined"),
|
undefined_name: Some(name.to_owned()),
|
||||||
vec![source_range],
|
details: KclErrorDetails::new(format!("`{name}` is not defined"), vec![source_range]),
|
||||||
)))
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Iterate over all key/value pairs in the specified environment which satisfy the provided
|
/// Iterate over all key/value pairs in the specified environment which satisfy the provided
|
||||||
@ -488,10 +488,10 @@ impl ProgramMemory {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
Err(KclError::UndefinedValue(KclErrorDetails::new(
|
Err(KclError::UndefinedValue {
|
||||||
format!("`{}` is not defined", var),
|
undefined_name: Some(var.to_owned()),
|
||||||
vec![],
|
details: KclErrorDetails::new(format!("`{}` is not defined", var), vec![]),
|
||||||
)))
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2072,8 +2072,8 @@ notPipeSub = 1 |> identity(!%))";
|
|||||||
// a runtime error instead.
|
// a runtime error instead.
|
||||||
parse_execute(code11).await.unwrap_err(),
|
parse_execute(code11).await.unwrap_err(),
|
||||||
KclError::Syntax(KclErrorDetails::new(
|
KclError::Syntax(KclErrorDetails::new(
|
||||||
"Unexpected token: |>".to_owned(),
|
"There was an unexpected !. Try removing it.".to_owned(),
|
||||||
vec![SourceRange::new(44, 46, ModuleId::default())],
|
vec![SourceRange::new(56, 57, ModuleId::default())],
|
||||||
))
|
))
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -80,6 +80,11 @@ pub(super) struct ModuleState {
|
|||||||
/// The current value of the pipe operator returned from the previous
|
/// The current value of the pipe operator returned from the previous
|
||||||
/// expression. If we're not currently in a pipeline, this will be None.
|
/// expression. If we're not currently in a pipeline, this will be None.
|
||||||
pub pipe_value: Option<KclValue>,
|
pub pipe_value: Option<KclValue>,
|
||||||
|
/// The closest variable declaration being executed in any parent node in the AST.
|
||||||
|
/// This is used to provide better error messages, e.g. noticing when the user is trying
|
||||||
|
/// to use the variable `length` inside the RHS of its own definition, like `length = tan(length)`.
|
||||||
|
/// TODO: Make this a reference.
|
||||||
|
pub being_declared: Option<String>,
|
||||||
/// Identifiers that have been exported from the current module.
|
/// Identifiers that have been exported from the current module.
|
||||||
pub module_exports: Vec<String>,
|
pub module_exports: Vec<String>,
|
||||||
/// Settings specified from annotations.
|
/// Settings specified from annotations.
|
||||||
@ -342,6 +347,7 @@ impl ModuleState {
|
|||||||
id_generator: IdGenerator::new(module_id),
|
id_generator: IdGenerator::new(module_id),
|
||||||
stack: memory.new_stack(),
|
stack: memory.new_stack(),
|
||||||
pipe_value: Default::default(),
|
pipe_value: Default::default(),
|
||||||
|
being_declared: Default::default(),
|
||||||
module_exports: Default::default(),
|
module_exports: Default::default(),
|
||||||
explicit_length_units: false,
|
explicit_length_units: false,
|
||||||
path,
|
path,
|
||||||
|
@ -979,12 +979,18 @@ fn property_separator(i: &mut TokenSlice) -> ModalResult<()> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Match something that separates the labeled arguments of a fn call.
|
/// Match something that separates the labeled arguments of a fn call.
|
||||||
fn labeled_arg_separator(i: &mut TokenSlice) -> ModalResult<()> {
|
/// Returns the source range of the erroneous separator, if any was found.
|
||||||
|
fn labeled_arg_separator(i: &mut TokenSlice) -> ModalResult<Option<SourceRange>> {
|
||||||
alt((
|
alt((
|
||||||
// Normally you need a comma.
|
// Normally you need a comma.
|
||||||
comma_sep,
|
comma_sep.map(|_| None),
|
||||||
// But, if the argument list is ending, no need for a comma.
|
// But, if the argument list is ending, no need for a comma.
|
||||||
peek(preceded(opt(whitespace), close_paren)).void(),
|
peek(preceded(opt(whitespace), close_paren)).void().map(|_| None),
|
||||||
|
whitespace.map(|mut tokens| {
|
||||||
|
// Safe to unwrap here because `whitespace` is guaranteed to return at least 1 whitespace.
|
||||||
|
let first_token = tokens.pop().unwrap();
|
||||||
|
Some(SourceRange::from(&first_token))
|
||||||
|
}),
|
||||||
))
|
))
|
||||||
.parse_next(i)
|
.parse_next(i)
|
||||||
}
|
}
|
||||||
@ -3135,7 +3141,7 @@ fn binding_name(i: &mut TokenSlice) -> ModalResult<Node<Identifier>> {
|
|||||||
|
|
||||||
/// Either a positional or keyword function call.
|
/// Either a positional or keyword function call.
|
||||||
fn fn_call_pos_or_kw(i: &mut TokenSlice) -> ModalResult<Expr> {
|
fn fn_call_pos_or_kw(i: &mut TokenSlice) -> ModalResult<Expr> {
|
||||||
alt((fn_call_kw.map(Box::new).map(Expr::CallExpressionKw),)).parse_next(i)
|
fn_call_kw.map(Box::new).map(Expr::CallExpressionKw).parse_next(i)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn labelled_fn_call(i: &mut TokenSlice) -> ModalResult<Expr> {
|
fn labelled_fn_call(i: &mut TokenSlice) -> ModalResult<Expr> {
|
||||||
@ -3198,7 +3204,7 @@ fn fn_call_kw(i: &mut TokenSlice) -> ModalResult<Node<CallExpressionKw>> {
|
|||||||
#[allow(clippy::large_enum_variant)]
|
#[allow(clippy::large_enum_variant)]
|
||||||
enum ArgPlace {
|
enum ArgPlace {
|
||||||
NonCode(Node<NonCodeNode>),
|
NonCode(Node<NonCodeNode>),
|
||||||
LabeledArg(LabeledArg),
|
LabeledArg((LabeledArg, Option<SourceRange>)),
|
||||||
UnlabeledArg(Expr),
|
UnlabeledArg(Expr),
|
||||||
Keyword(Token),
|
Keyword(Token),
|
||||||
}
|
}
|
||||||
@ -3208,7 +3214,7 @@ fn fn_call_kw(i: &mut TokenSlice) -> ModalResult<Node<CallExpressionKw>> {
|
|||||||
alt((
|
alt((
|
||||||
terminated(non_code_node.map(ArgPlace::NonCode), whitespace),
|
terminated(non_code_node.map(ArgPlace::NonCode), whitespace),
|
||||||
terminated(any_keyword.map(ArgPlace::Keyword), whitespace),
|
terminated(any_keyword.map(ArgPlace::Keyword), whitespace),
|
||||||
terminated(labeled_argument, labeled_arg_separator).map(ArgPlace::LabeledArg),
|
(labeled_argument, labeled_arg_separator).map(ArgPlace::LabeledArg),
|
||||||
expression.map(ArgPlace::UnlabeledArg),
|
expression.map(ArgPlace::UnlabeledArg),
|
||||||
)),
|
)),
|
||||||
)
|
)
|
||||||
@ -3220,7 +3226,16 @@ fn fn_call_kw(i: &mut TokenSlice) -> ModalResult<Node<CallExpressionKw>> {
|
|||||||
ArgPlace::NonCode(x) => {
|
ArgPlace::NonCode(x) => {
|
||||||
non_code_nodes.insert(index, vec![x]);
|
non_code_nodes.insert(index, vec![x]);
|
||||||
}
|
}
|
||||||
ArgPlace::LabeledArg(x) => {
|
ArgPlace::LabeledArg((x, bad_token_source_range)) => {
|
||||||
|
if let Some(bad_token_source_range) = bad_token_source_range {
|
||||||
|
return Err(ErrMode::Cut(
|
||||||
|
CompilationError::fatal(
|
||||||
|
bad_token_source_range,
|
||||||
|
"Missing comma between arguments, try adding a comma in",
|
||||||
|
)
|
||||||
|
.into(),
|
||||||
|
));
|
||||||
|
}
|
||||||
args.push(x);
|
args.push(x);
|
||||||
}
|
}
|
||||||
ArgPlace::Keyword(kw) => {
|
ArgPlace::Keyword(kw) => {
|
||||||
@ -3255,7 +3270,22 @@ fn fn_call_kw(i: &mut TokenSlice) -> ModalResult<Node<CallExpressionKw>> {
|
|||||||
)?;
|
)?;
|
||||||
ignore_whitespace(i);
|
ignore_whitespace(i);
|
||||||
opt(comma_sep).parse_next(i)?;
|
opt(comma_sep).parse_next(i)?;
|
||||||
let end = close_paren.parse_next(i)?.end;
|
let end = match close_paren.parse_next(i) {
|
||||||
|
Ok(tok) => tok.end,
|
||||||
|
Err(e) => {
|
||||||
|
if let Some(tok) = i.next_token() {
|
||||||
|
return Err(ErrMode::Cut(
|
||||||
|
CompilationError::fatal(
|
||||||
|
SourceRange::from(&tok),
|
||||||
|
format!("There was an unexpected {}. Try removing it.", tok.value),
|
||||||
|
)
|
||||||
|
.into(),
|
||||||
|
));
|
||||||
|
} else {
|
||||||
|
return Err(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
// Validate there aren't any duplicate labels.
|
// Validate there aren't any duplicate labels.
|
||||||
let mut counted_labels = IndexMap::with_capacity(args.len());
|
let mut counted_labels = IndexMap::with_capacity(args.len());
|
||||||
@ -3376,8 +3406,7 @@ mod tests {
|
|||||||
fn kw_call_as_operand() {
|
fn kw_call_as_operand() {
|
||||||
let tokens = crate::parsing::token::lex("f(x = 1)", ModuleId::default()).unwrap();
|
let tokens = crate::parsing::token::lex("f(x = 1)", ModuleId::default()).unwrap();
|
||||||
let tokens = tokens.as_slice();
|
let tokens = tokens.as_slice();
|
||||||
let op = operand.parse(tokens).unwrap();
|
operand.parse(tokens).unwrap();
|
||||||
println!("{op:#?}");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -4417,8 +4446,8 @@ z(-[["#,
|
|||||||
assert_err(
|
assert_err(
|
||||||
r#"z
|
r#"z
|
||||||
(--#"#,
|
(--#"#,
|
||||||
"Unexpected token: (",
|
"There was an unexpected -. Try removing it.",
|
||||||
[2, 3],
|
[3, 4],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5133,6 +5162,27 @@ bar = 1
|
|||||||
assert_eq!(actual.operator, UnaryOperator::Not);
|
assert_eq!(actual.operator, UnaryOperator::Not);
|
||||||
crate::parsing::top_level_parse(some_program_string).unwrap(); // Updated import path
|
crate::parsing::top_level_parse(some_program_string).unwrap(); // Updated import path
|
||||||
}
|
}
|
||||||
|
#[test]
|
||||||
|
fn test_sensible_error_when_missing_comma_between_fn_args() {
|
||||||
|
let program_source = "startSketchOn(XY)
|
||||||
|
|> arc(
|
||||||
|
endAbsolute = [0, 50]
|
||||||
|
interiorAbsolute = [-50, 0]
|
||||||
|
)";
|
||||||
|
let expected_src_start = program_source.find("]").unwrap();
|
||||||
|
let tokens = crate::parsing::token::lex(program_source, ModuleId::default()).unwrap();
|
||||||
|
ParseContext::init();
|
||||||
|
let err = program
|
||||||
|
.parse(tokens.as_slice())
|
||||||
|
.expect_err("Program succeeded, but it should have failed");
|
||||||
|
let cause = err
|
||||||
|
.inner()
|
||||||
|
.cause
|
||||||
|
.as_ref()
|
||||||
|
.expect("Found an error, but there was no cause. Add a cause.");
|
||||||
|
assert_eq!(cause.message, "Missing comma between arguments, try adding a comma in",);
|
||||||
|
assert_eq!(cause.source_range.start() - 1, expected_src_start);
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_sensible_error_when_missing_rhs_of_kw_arg() {
|
fn test_sensible_error_when_missing_rhs_of_kw_arg() {
|
||||||
@ -5152,14 +5202,32 @@ bar = 1
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_sensible_error_when_unexpected_token_in_fn_call() {
|
||||||
|
let program_source = "1
|
||||||
|
|> extrude(
|
||||||
|
length=depth,
|
||||||
|
})";
|
||||||
|
let expected_src_start = program_source.find("}").expect("Program should have an extraneous }");
|
||||||
|
let tokens = crate::parsing::token::lex(program_source, ModuleId::default()).unwrap();
|
||||||
|
ParseContext::init();
|
||||||
|
let err = program.parse(tokens.as_slice()).unwrap_err();
|
||||||
|
let cause = err
|
||||||
|
.inner()
|
||||||
|
.cause
|
||||||
|
.as_ref()
|
||||||
|
.expect("Found an error, but there was no cause. Add a cause.");
|
||||||
|
assert_eq!(cause.message, "There was an unexpected }. Try removing it.",);
|
||||||
|
assert_eq!(cause.source_range.start(), expected_src_start);
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_sensible_error_when_using_keyword_as_arg_label() {
|
fn test_sensible_error_when_using_keyword_as_arg_label() {
|
||||||
for (i, program) in ["pow(2, fn = 8)"].into_iter().enumerate() {
|
for (i, program) in ["pow(2, fn = 8)"].into_iter().enumerate() {
|
||||||
let tokens = crate::parsing::token::lex(program, ModuleId::default()).unwrap();
|
let tokens = crate::parsing::token::lex(program, ModuleId::default()).unwrap();
|
||||||
let err = match fn_call_kw.parse(tokens.as_slice()) {
|
let err = match fn_call_kw.parse(tokens.as_slice()) {
|
||||||
Err(e) => e,
|
Err(e) => e,
|
||||||
Ok(ast) => {
|
Ok(_ast) => {
|
||||||
eprintln!("{ast:#?}");
|
|
||||||
panic!("Expected this to error but it didn't");
|
panic!("Expected this to error but it didn't");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -3483,3 +3483,24 @@ mod spheres {
|
|||||||
super::execute(TEST_NAME, true).await
|
super::execute(TEST_NAME, true).await
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
mod var_ref_in_own_def {
|
||||||
|
const TEST_NAME: &str = "var_ref_in_own_def";
|
||||||
|
|
||||||
|
/// Test parsing KCL.
|
||||||
|
#[test]
|
||||||
|
fn parse() {
|
||||||
|
super::parse(TEST_NAME)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Test that parsing and unparsing KCL produces the original KCL input.
|
||||||
|
#[tokio::test(flavor = "multi_thread")]
|
||||||
|
async fn unparse() {
|
||||||
|
super::unparse(TEST_NAME).await
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Test that KCL is executed correctly.
|
||||||
|
#[tokio::test(flavor = "multi_thread")]
|
||||||
|
async fn kcl_test_execute() {
|
||||||
|
super::execute(TEST_NAME, true).await
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -23,7 +23,7 @@ pub async fn union(exec_state: &mut ExecState, args: Args) -> Result<KclValue, K
|
|||||||
let tolerance: Option<TyF64> = args.get_kw_arg_opt_typed("tolerance", &RuntimeType::length(), exec_state)?;
|
let tolerance: Option<TyF64> = args.get_kw_arg_opt_typed("tolerance", &RuntimeType::length(), exec_state)?;
|
||||||
|
|
||||||
if solids.len() < 2 {
|
if solids.len() < 2 {
|
||||||
return Err(KclError::UndefinedValue(KclErrorDetails::new(
|
return Err(KclError::Semantic(KclErrorDetails::new(
|
||||||
"At least two solids are required for a union operation.".to_string(),
|
"At least two solids are required for a union operation.".to_string(),
|
||||||
vec![args.source_range],
|
vec![args.source_range],
|
||||||
)));
|
)));
|
||||||
@ -88,7 +88,7 @@ pub async fn intersect(exec_state: &mut ExecState, args: Args) -> Result<KclValu
|
|||||||
let tolerance: Option<TyF64> = args.get_kw_arg_opt_typed("tolerance", &RuntimeType::length(), exec_state)?;
|
let tolerance: Option<TyF64> = args.get_kw_arg_opt_typed("tolerance", &RuntimeType::length(), exec_state)?;
|
||||||
|
|
||||||
if solids.len() < 2 {
|
if solids.len() < 2 {
|
||||||
return Err(KclError::UndefinedValue(KclErrorDetails::new(
|
return Err(KclError::Semantic(KclErrorDetails::new(
|
||||||
"At least two solids are required for an intersect operation.".to_string(),
|
"At least two solids are required for an intersect operation.".to_string(),
|
||||||
vec![args.source_range],
|
vec![args.source_range],
|
||||||
)));
|
)));
|
||||||
|
32
rust/kcl-lib/tests/var_ref_in_own_def/artifact_commands.snap
Normal file
32
rust/kcl-lib/tests/var_ref_in_own_def/artifact_commands.snap
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
---
|
||||||
|
source: kcl-lib/src/simulation_tests.rs
|
||||||
|
description: Artifact commands var_ref_in_own_def.kcl
|
||||||
|
---
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"cmdId": "[uuid]",
|
||||||
|
"range": [],
|
||||||
|
"command": {
|
||||||
|
"type": "edge_lines_visible",
|
||||||
|
"hidden": false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cmdId": "[uuid]",
|
||||||
|
"range": [],
|
||||||
|
"command": {
|
||||||
|
"type": "object_visible",
|
||||||
|
"object_id": "[uuid]",
|
||||||
|
"hidden": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cmdId": "[uuid]",
|
||||||
|
"range": [],
|
||||||
|
"command": {
|
||||||
|
"type": "object_visible",
|
||||||
|
"object_id": "[uuid]",
|
||||||
|
"hidden": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
@ -0,0 +1,6 @@
|
|||||||
|
---
|
||||||
|
source: kcl-lib/src/simulation_tests.rs
|
||||||
|
description: Artifact graph flowchart var_ref_in_own_def.kcl
|
||||||
|
extension: md
|
||||||
|
snapshot_kind: binary
|
||||||
|
---
|
@ -0,0 +1,3 @@
|
|||||||
|
```mermaid
|
||||||
|
flowchart LR
|
||||||
|
```
|
75
rust/kcl-lib/tests/var_ref_in_own_def/ast.snap
Normal file
75
rust/kcl-lib/tests/var_ref_in_own_def/ast.snap
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
---
|
||||||
|
source: kcl-lib/src/simulation_tests.rs
|
||||||
|
description: Result of parsing var_ref_in_own_def.kcl
|
||||||
|
---
|
||||||
|
{
|
||||||
|
"Ok": {
|
||||||
|
"body": [
|
||||||
|
{
|
||||||
|
"commentStart": 0,
|
||||||
|
"declaration": {
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"id": {
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"name": "x",
|
||||||
|
"start": 0,
|
||||||
|
"type": "Identifier"
|
||||||
|
},
|
||||||
|
"init": {
|
||||||
|
"callee": {
|
||||||
|
"abs_path": false,
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"name": {
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"name": "cos",
|
||||||
|
"start": 0,
|
||||||
|
"type": "Identifier"
|
||||||
|
},
|
||||||
|
"path": [],
|
||||||
|
"start": 0,
|
||||||
|
"type": "Name"
|
||||||
|
},
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"start": 0,
|
||||||
|
"type": "CallExpressionKw",
|
||||||
|
"type": "CallExpressionKw",
|
||||||
|
"unlabeled": {
|
||||||
|
"abs_path": false,
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"name": {
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"name": "x",
|
||||||
|
"start": 0,
|
||||||
|
"type": "Identifier"
|
||||||
|
},
|
||||||
|
"path": [],
|
||||||
|
"start": 0,
|
||||||
|
"type": "Name",
|
||||||
|
"type": "Name"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"start": 0,
|
||||||
|
"type": "VariableDeclarator"
|
||||||
|
},
|
||||||
|
"end": 0,
|
||||||
|
"kind": "const",
|
||||||
|
"preComments": [
|
||||||
|
"// This won't work, because `x` is being referenced in its own definition."
|
||||||
|
],
|
||||||
|
"start": 0,
|
||||||
|
"type": "VariableDeclaration",
|
||||||
|
"type": "VariableDeclaration"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"start": 0
|
||||||
|
}
|
||||||
|
}
|
14
rust/kcl-lib/tests/var_ref_in_own_def/execution_error.snap
Normal file
14
rust/kcl-lib/tests/var_ref_in_own_def/execution_error.snap
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
---
|
||||||
|
source: kcl-lib/src/simulation_tests.rs
|
||||||
|
description: Error from executing var_ref_in_own_def.kcl
|
||||||
|
---
|
||||||
|
KCL UndefinedValue error
|
||||||
|
|
||||||
|
× undefined value: You can't use `x` because you're currently trying to
|
||||||
|
│ define it. Use a different variable here instead.
|
||||||
|
╭─[2:9]
|
||||||
|
1 │ // This won't work, because `x` is being referenced in its own definition.
|
||||||
|
2 │ x = cos(x)
|
||||||
|
· ┬
|
||||||
|
· ╰── tests/var_ref_in_own_def/input.kcl
|
||||||
|
╰────
|
2
rust/kcl-lib/tests/var_ref_in_own_def/input.kcl
Normal file
2
rust/kcl-lib/tests/var_ref_in_own_def/input.kcl
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
// This won't work, because `x` is being referenced in its own definition.
|
||||||
|
x = cos(x)
|
5
rust/kcl-lib/tests/var_ref_in_own_def/ops.snap
Normal file
5
rust/kcl-lib/tests/var_ref_in_own_def/ops.snap
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
source: kcl-lib/src/simulation_tests.rs
|
||||||
|
description: Operations executed var_ref_in_own_def.kcl
|
||||||
|
---
|
||||||
|
[]
|
6
rust/kcl-lib/tests/var_ref_in_own_def/unparsed.snap
Normal file
6
rust/kcl-lib/tests/var_ref_in_own_def/unparsed.snap
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
---
|
||||||
|
source: kcl-lib/src/simulation_tests.rs
|
||||||
|
description: Result of unparsing var_ref_in_own_def.kcl
|
||||||
|
---
|
||||||
|
// This won't work, because `x` is being referenced in its own definition.
|
||||||
|
x = cos(x)
|
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "kcl-python-bindings"
|
name = "kcl-python-bindings"
|
||||||
version = "0.3.77"
|
version = "0.3.78"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
repository = "https://github.com/kittycad/modeling-app"
|
repository = "https://github.com/kittycad/modeling-app"
|
||||||
exclude = ["tests/*", "files/*", "venv/*"]
|
exclude = ["tests/*", "files/*", "venv/*"]
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "kcl-test-server"
|
name = "kcl-test-server"
|
||||||
description = "A test server for KCL"
|
description = "A test server for KCL"
|
||||||
version = "0.1.77"
|
version = "0.1.78"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "kcl-to-core"
|
name = "kcl-to-core"
|
||||||
description = "Utility methods to convert kcl to engine core executable tests"
|
description = "Utility methods to convert kcl to engine core executable tests"
|
||||||
version = "0.1.77"
|
version = "0.1.78"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
repository = "https://github.com/KittyCAD/modeling-app"
|
repository = "https://github.com/KittyCAD/modeling-app"
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "kcl-wasm-lib"
|
name = "kcl-wasm-lib"
|
||||||
version = "0.1.77"
|
version = "0.1.78"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
repository = "https://github.com/KittyCAD/modeling-app"
|
repository = "https://github.com/KittyCAD/modeling-app"
|
||||||
rust-version = "1.83"
|
rust-version = "1.83"
|
||||||
|
Reference in New Issue
Block a user