mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-19 02:48:12 +08:00
Show red connectors on a type-erroring node and accurate connector colors upstream of it (#3110)
* Refactor TypeSource * Add complete valid types * Add invalid type * Improve valid/complete types and disconnecting * Code review * Return types on error --------- Co-authored-by: Keavon Chambers <keavon@keavon.com>
This commit is contained in:
@@ -211,6 +211,14 @@ pub enum DocumentNodeMetadata {
|
||||
DocumentNodePath,
|
||||
}
|
||||
|
||||
impl DocumentNodeMetadata {
|
||||
pub fn ty(&self) -> Type {
|
||||
match self {
|
||||
DocumentNodeMetadata::DocumentNodePath => concrete!(Vec<NodeId>),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl NodeInput {
|
||||
pub const fn node(node_id: NodeId, output_index: usize) -> Self {
|
||||
Self::Node { node_id, output_index }
|
||||
|
||||
@@ -539,7 +539,6 @@ impl ProtoNetwork {
|
||||
#[derive(Clone, PartialEq, serde::Serialize, serde::Deserialize)]
|
||||
pub enum GraphErrorType {
|
||||
NodeNotFound(NodeId),
|
||||
InputNodeNotFound(NodeId),
|
||||
UnexpectedGenerics { index: usize, inputs: Vec<Type> },
|
||||
NoImplementations,
|
||||
NoConstructor,
|
||||
@@ -551,7 +550,6 @@ impl Debug for GraphErrorType {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
match self {
|
||||
GraphErrorType::NodeNotFound(id) => write!(f, "Input node {id} is not present in the typing context"),
|
||||
GraphErrorType::InputNodeNotFound(id) => write!(f, "Input node {id} is not present in the typing context"),
|
||||
GraphErrorType::UnexpectedGenerics { index, inputs } => write!(f, "Generic inputs should not exist but found at {index}: {inputs:?}"),
|
||||
GraphErrorType::NoImplementations => write!(f, "No implementations found"),
|
||||
GraphErrorType::NoConstructor => write!(f, "No construct found for node"),
|
||||
|
||||
Reference in New Issue
Block a user