mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-02 08:11:12 +00:00
Merge pull request #2533 from rtfeldman/abilities!
[WIP] Spike for abilities and friends
This commit is contained in:
commit
ca9ecbea52
56 changed files with 1317 additions and 263 deletions
|
@ -10,6 +10,7 @@ use bumpalo::Bump;
|
|||
use roc_builtins::bitcode::{FloatWidth, IntWidth};
|
||||
use roc_can::expr::{ClosureData, IntValue};
|
||||
use roc_collections::all::{default_hasher, BumpMap, BumpMapDefault, MutMap};
|
||||
use roc_error_macros::todo_opaques;
|
||||
use roc_module::ident::{ForeignSymbol, Lowercase, TagName};
|
||||
use roc_module::low_level::LowLevel;
|
||||
use roc_module::symbol::{IdentIds, ModuleId, Symbol};
|
||||
|
@ -2012,6 +2013,13 @@ fn pattern_to_when<'a>(
|
|||
(env.unique_symbol(), Loc::at_zero(RuntimeError(error)))
|
||||
}
|
||||
|
||||
OpaqueNotInScope(loc_ident) => {
|
||||
// create the runtime error here, instead of delegating to When.
|
||||
// TODO(opaques) should be `RuntimeError::OpaqueNotDefined`
|
||||
let error = roc_problem::can::RuntimeError::UnsupportedPattern(loc_ident.region);
|
||||
(env.unique_symbol(), Loc::at_zero(RuntimeError(error)))
|
||||
}
|
||||
|
||||
AppliedTag { .. } | RecordDestructure { .. } => {
|
||||
let symbol = env.unique_symbol();
|
||||
|
||||
|
@ -2030,6 +2038,8 @@ fn pattern_to_when<'a>(
|
|||
(symbol, Loc::at_zero(wrapped_body))
|
||||
}
|
||||
|
||||
UnwrappedOpaque { .. } => todo_opaques!(),
|
||||
|
||||
IntLiteral(..) | NumLiteral(..) | FloatLiteral(..) | StrLiteral(_) => {
|
||||
// These patters are refutable, and thus should never occur outside a `when` expression
|
||||
// They should have been replaced with `UnsupportedPattern` during canonicalization
|
||||
|
@ -3412,6 +3422,8 @@ pub fn with_hole<'a>(
|
|||
}
|
||||
}
|
||||
|
||||
OpaqueRef { .. } => todo_opaques!(),
|
||||
|
||||
Record {
|
||||
record_var,
|
||||
mut fields,
|
||||
|
@ -7741,6 +7753,10 @@ fn from_can_pattern_help<'a>(
|
|||
// TODO preserve malformed problem information here?
|
||||
Err(RuntimeError::UnsupportedPattern(*region))
|
||||
}
|
||||
OpaqueNotInScope(loc_ident) => {
|
||||
// TODO(opaques) should be `RuntimeError::OpaqueNotDefined`
|
||||
Err(RuntimeError::UnsupportedPattern(loc_ident.region))
|
||||
}
|
||||
NumLiteral(var, num_str, num, _bound) => {
|
||||
match num_argument_to_int_or_float(env.subs, env.target_info, *var, false) {
|
||||
IntOrFloat::Int(precision) => Ok(match num {
|
||||
|
@ -8189,6 +8205,8 @@ fn from_can_pattern_help<'a>(
|
|||
Ok(result)
|
||||
}
|
||||
|
||||
UnwrappedOpaque { .. } => todo_opaques!(),
|
||||
|
||||
RecordDestructure {
|
||||
whole_var,
|
||||
destructs,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue