report malformed int and float patterns

This commit is contained in:
Folkert 2020-07-04 17:06:27 +02:00
parent a05b664be0
commit 0c7a4179aa
8 changed files with 208 additions and 27 deletions

View file

@ -3,6 +3,7 @@ use roc_collections::all::MutSet;
use roc_module::ident::{Ident, Lowercase, TagName};
use roc_module::operator::BinOp;
use roc_module::symbol::{ModuleId, Symbol};
use roc_parse::ast::Base;
use roc_parse::pattern::PatternType;
use roc_region::all::{Located, Region};
@ -69,6 +70,8 @@ pub enum RuntimeError {
},
// Example: (5 = 1 + 2) is an unsupported pattern in an assignment; Int patterns aren't allowed in assignments!
UnsupportedPattern(Region),
// Example: when 1 is 1.X -> 32
MalformedPattern(MalformedPatternProblem, Region),
UnrecognizedFunctionName(Located<InlinableString>),
LookupNotInScope(Located<InlinableString>, MutSet<Box<str>>),
ValueNotExposed {
@ -95,3 +98,10 @@ pub enum RuntimeError {
/// When the author specifies a type annotation but no implementation
NoImplementation,
}
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum MalformedPatternProblem {
MalformedInt,
MalformedFloat,
MalformedBase(Base),
}