From 73ada458ec3b9587fce9263f2f054dc6474ee80b Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Mon, 29 Apr 2024 21:17:20 +0200 Subject: rebel-lang: typing: do not accept _ in expressions _ is a pattern, not an expression. --- crates/rebel-lang/src/typing.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/crates/rebel-lang/src/typing.rs b/crates/rebel-lang/src/typing.rs index 70fc759..140b8cb 100644 --- a/crates/rebel-lang/src/typing.rs +++ b/crates/rebel-lang/src/typing.rs @@ -330,10 +330,8 @@ impl Type { } fn path_expr_type(ctx: &Context, path: &ast::Path<'_>) -> Result { - use Type::*; - if path.components == [ast::Ident { name: "_" }] { - return Ok(Free); + return Err(TypeError); } ctx.vars -- cgit v1.2.3