Integrate type checking into context dependency analysis

This commit is contained in:
Dennis Kobert
2025-09-18 10:20:32 +02:00
parent e73e524f3d
commit 7d3efffdac
8 changed files with 113 additions and 54 deletions

View File

@@ -116,6 +116,10 @@ impl DynamicExecutor {
self.typing_context.type_of(self.output).map(|node_io| node_io.call_argument.clone())
}
pub fn typing_context_mut(&mut self) -> &mut TypingContext {
&mut self.typing_context
}
pub fn tree(&self) -> &BorrowTree {
&self.tree
}

View File

@@ -6,6 +6,7 @@ pub mod util;
mod tests {
use core_types::*;
use futures::executor::block_on;
use graph_craft::proto::TypingContext;
use graphene_core::ops::identity;
#[test]
@@ -45,7 +46,8 @@ mod tests {
use graph_craft::graphene_compiler::Compiler;
let compiler = Compiler {};
let protograph = compiler.compile_single(network).expect("Graph should be generated");
let mut ty = TypingContext::new(&crate::node_registry::NODE_REGISTRY);
let protograph = compiler.compile_single(network, &mut ty).expect("Graph should be generated");
let _exec = block_on(DynamicExecutor::new(protograph)).map(|_e| panic!("The network should not type check ")).unwrap_err();
}

View File

@@ -396,6 +396,7 @@ mod node_registry_macros {
(
ProtoNodeIdentifier::new(concat!["graphene_core::ops::ConvertNode<", stringify!($to), ">"]),
|mut args| {
log::debug!("registering convert from {:?} to {:?} with {:?}", stringify!($from), stringify!($to), stringify!($convert));
Box::pin(async move {
let mut args = args.drain(..);
let node = graphene_std::ops::ConvertNode::new(
@@ -416,6 +417,7 @@ mod node_registry_macros {
);
let params = vec![fn_type_fut!(Context, $from), fn_type_fut!(Context, $convert)];
let node_io = NodeIO::<'_, Context>::to_async_node_io(&node, params);
// log::debug!("node io: {:?}", node_io);
node_io
},
)