From af43e35567f19f2a65df2e32228f9b66dcf9a7d6 Mon Sep 17 00:00:00 2001 From: Mike Gerwitz Date: Wed, 12 Apr 2023 11:39:29 -0400 Subject: [PATCH] tamer: nir::air: Reject Todo* tokens XIRF->Nir produces `Todo` and `TodoAttr` tokens for many different things. The previous approach was to ignore those things so that I could begin adding portions of packages to the graph and observe how that goes. But now that I'm starting to be able to compile certain packages that utilize only small subsets of TAME features, I need to have confidence that I'm fully parsing them. This means rejecting tokens that I haven't yet gotten to. DEV-13708 --- tamer/src/nir/air.rs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/tamer/src/nir/air.rs b/tamer/src/nir/air.rs index af86c20e..9802d809 100644 --- a/tamer/src/nir/air.rs +++ b/tamer/src/nir/air.rs @@ -25,7 +25,7 @@ use crate::{ diagnose::{Annotate, Diagnostic}, fmt::{DisplayWrapper, TtQuote}, parse::prelude::*, - span::{Span, UNKNOWN_SPAN}, + span::Span, sym::{st::raw::U_TRUE, SymbolId}, }; use arrayvec::ArrayVec; @@ -95,7 +95,7 @@ impl ParseState for NirToAir { use NirToAir::*; let _ = tok; // prevent `unused_variables` warning - Transition(Ready).ok(Air::Todo(UNKNOWN_SPAN)) + Transition(Ready).ok(Air::Todo(crate::span::UNKNOWN_SPAN)) } #[cfg(feature = "wip-asg-derived-xmli")] @@ -255,8 +255,13 @@ impl ParseState for NirToAir { Transition(Ready).ok(Air::DocIndepClause(clause)) } - (_, Todo(..) | TodoAttr(..)) => { - Transition(Ready).ok(Air::Todo(UNKNOWN_SPAN)) + (_, tok @ (Todo(..) | TodoAttr(..))) => { + crate::diagnostic_todo!( + vec![tok.internal_error( + "this token is not yet supported in TAMER" + )], + "unsupported token: {tok}", + ) } (st, Noop(_)) => Transition(st).incomplete(),