Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 4 additions & 12 deletions .github/renovate.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,12 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"config:best-practices"
],
"ignoreDeps": [
"taiki-e/install-action"
],
"extends": ["config:best-practices"],
"ignoreDeps": ["taiki-e/install-action"],
"packageRules": [
{
"matchManagers": [
"cargo"
],
"matchManagers": ["cargo"],
"groupName": "arborium crates",
"matchPackageNames": [
"/^arborium-/"
]
"matchPackageNames": ["/^arborium-/"]
}
]
}
4 changes: 2 additions & 2 deletions crates/plotnik-lib/src/query/alt_kinds.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ impl AltKindsValidator<'_> {

let tagged_range = tagged_branch
.label()
.map(|t| t.text_range())
.unwrap_or_else(|| branch_range(tagged_branch));
.expect("tagged branch found via filter must have label")
.text_range();

let untagged_range = branch_range(untagged_branch);

Expand Down
7 changes: 4 additions & 3 deletions crates/plotnik-lib/src/query/dependencies.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,10 @@ impl<'a, 'd> RecursionValidator<'a, 'd> {
// A component is recursive if it has >1 node, or 1 node that references itself.
if scc.len() == 1 {
let name = &scc[0];
let Some(body) = self.symbol_table.get(name) else {
return;
};
let body = self
.symbol_table
.get(name)
.expect("node in SCC must exist in symbol table");
if !collect_refs(body, self.symbol_table).contains(name.as_str()) {
return;
}
Expand Down
5 changes: 4 additions & 1 deletion crates/plotnik-lib/src/query/link.rs
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,10 @@ impl<'a, 'q> Linker<'a, 'q> {
parent_range: TextRange,
) {
let valid_fields = self.lang.fields_for_node_type(parent_id);
let parent_name = self.lang.node_type_name(parent_id).unwrap_or("(unknown)");
let parent_name = self
.lang
.node_type_name(parent_id)
.expect("validated parent_id must have a name");

let mut builder = self
.diagnostics
Expand Down
63 changes: 36 additions & 27 deletions crates/plotnik-lib/src/query/type_check/emit_ts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -195,9 +195,10 @@ impl<'a> TsEmitter<'a> {
return;
}

let Some(kind) = self.ctx.get_type(type_id) else {
return;
};
let kind = self
.ctx
.get_type(type_id)
.expect("valid TypeId required for naming context");

match kind {
TypeKind::Struct(fields) => {
Expand Down Expand Up @@ -239,9 +240,10 @@ impl<'a> TsEmitter<'a> {
return;
}

let Some(kind) = self.ctx.get_type(type_id) else {
return;
};
let kind = self
.ctx
.get_type(type_id)
.expect("valid TypeId required for builtin collection");

match kind {
TypeKind::Node | TypeKind::Custom(_) => {
Expand Down Expand Up @@ -319,9 +321,10 @@ impl<'a> TsEmitter<'a> {
return;
}

let Some(kind) = self.ctx.get_type(type_id) else {
return;
};
let kind = self
.ctx
.get_type(type_id)
.expect("valid TypeId required for reachability");

match kind {
TypeKind::Struct(fields) => {
Expand All @@ -340,9 +343,10 @@ impl<'a> TsEmitter<'a> {
}

fn get_direct_deps(&self, type_id: TypeId) -> Vec<TypeId> {
let Some(kind) = self.ctx.get_type(type_id) else {
return vec![];
};
let kind = self
.ctx
.get_type(type_id)
.expect("valid TypeId required for dependency calculation");
match kind {
TypeKind::Struct(fields) => fields
.values()
Expand All @@ -362,9 +366,10 @@ impl<'a> TsEmitter<'a> {
if type_id.is_builtin() {
return vec![];
}
let Some(kind) = self.ctx.get_type(type_id) else {
return vec![];
};
let kind = self
.ctx
.get_type(type_id)
.expect("valid TypeId required for unwrapping");
match kind {
TypeKind::Array { element, .. } => self.unwrap_for_deps(*element),
TypeKind::Optional(inner) => self.unwrap_for_deps(*inner),
Expand All @@ -389,9 +394,10 @@ impl<'a> TsEmitter<'a> {
fn emit_generated_type_def(&mut self, type_id: TypeId, name: &str) {
self.emitted.insert(type_id);
let export = if self.config.export { "export " } else { "" };
let Some(kind) = self.ctx.get_type(type_id) else {
return;
};
let kind = self
.ctx
.get_type(type_id)
.expect("valid TypeId required for generation");

match kind {
TypeKind::Struct(fields) => self.emit_interface(name, fields, export),
Expand All @@ -405,9 +411,10 @@ impl<'a> TsEmitter<'a> {
let export = if self.config.export { "export " } else { "" };
let type_name = to_pascal_case(name);

let Some(kind) = self.ctx.get_type(type_id) else {
return;
};
let kind = self
.ctx
.get_type(type_id)
.expect("valid TypeId required for definition emission");

match kind {
TypeKind::Struct(fields) => {
Expand Down Expand Up @@ -496,9 +503,10 @@ impl<'a> TsEmitter<'a> {
_ => {}
}

let Some(kind) = self.ctx.get_type(type_id) else {
return "unknown".to_string();
};
let kind = self
.ctx
.get_type(type_id)
.expect("valid TypeId required for TS conversion");

match kind {
TypeKind::Void => "void".to_string(),
Expand Down Expand Up @@ -567,9 +575,10 @@ impl<'a> TsEmitter<'a> {
}

fn inline_data_type(&self, type_id: TypeId) -> String {
let Some(kind) = self.ctx.get_type(type_id) else {
return "unknown".to_string();
};
let kind = self
.ctx
.get_type(type_id)
.expect("valid TypeId required for inline data emission");

match kind {
TypeKind::Struct(fields) => self.inline_struct(fields),
Expand Down
7 changes: 4 additions & 3 deletions crates/plotnik-lib/src/query/type_check/infer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -498,9 +498,10 @@ impl<'a, 'd> InferenceVisitor<'a, 'd> {
return;
};

let Some(fields) = self.ctx.get_struct_fields(*type_id) else {
return;
};
let fields = self
.ctx
.get_struct_fields(*type_id)
.expect("Bubble flow must point to a Struct type");
if fields.is_empty() {
return;
}
Expand Down