Fork of daniellemaywood.uk/gleam — Wasm codegen work
2

Configure Feed

Select the types of activity you want to include in your feed.

new TypeError w/ check in check_case_exhaustiveness

+30
+20
compiler-core/src/error.rs
··· 2572 2572 } 2573 2573 } 2574 2574 2575 + TypeError::EmptyCaseExpression { location } => { 2576 + let text: String = "This case expression has no clauses.".into(); 2577 + 2578 + Diagnostic { 2579 + title: "Empty case expression".into(), 2580 + text, 2581 + hint: None, 2582 + level: Level::Error, 2583 + location: Some(Location { 2584 + src: src.clone(), 2585 + path: path.to_path_buf(), 2586 + label: Label { 2587 + text: None, 2588 + span: *location, 2589 + }, 2590 + extra_labels: Vec::new(), 2591 + }), 2592 + } 2593 + } 2594 + 2575 2595 TypeError::InexhaustiveCaseExpression { location, missing } => { 2576 2596 let mut text: String = 2577 2597 "This case expression does not have a pattern for all possible values.
+5
compiler-core/src/type_/error.rs
··· 313 313 name: EcoString, 314 314 }, 315 315 316 + /// A case expression contains no clauses. 317 + EmptyCaseExpression { 318 + location: SrcSpan, 319 + }, 320 + 316 321 /// A case expression is missing one or more patterns to match all possible 317 322 /// values of the type. 318 323 InexhaustiveCaseExpression {
+5
compiler-core/src/type_/expression.rs
··· 2551 2551 ) -> Result<(), Error> { 2552 2552 use exhaustiveness::{Body, Column, Compiler, PatternArena, Row}; 2553 2553 2554 + // Error for empty clauses, must be caught before full exhaustiveness check 2555 + if clauses.is_empty() { 2556 + return Err(Error::EmptyCaseExpression { location }); 2557 + } 2558 + 2554 2559 let mut compiler = Compiler::new(self.environment, Arena::new()); 2555 2560 let mut arena = PatternArena::new(); 2556 2561