mirror of
https://github.com/roc-lang/roc.git
synced 2025-08-03 03:42:17 +00:00
Import all types from Encode by default
This commit is contained in:
parent
7e5ff4883f
commit
454f3634fd
2 changed files with 15 additions and 1 deletions
|
@ -80,6 +80,8 @@ const MODULE_SEPARATOR: char = '.';
|
|||
|
||||
const EXPANDED_STACK_SIZE: usize = 8 * 1024 * 1024;
|
||||
|
||||
/// TODO: how can we populate these at compile/runtime from the standard library?
|
||||
/// Consider updating the macro in symbol to do this?
|
||||
const PRELUDE_TYPES: [(&str, Symbol); 33] = [
|
||||
("Num", Symbol::NUM_NUM),
|
||||
("Int", Symbol::NUM_INT),
|
||||
|
@ -116,6 +118,12 @@ const PRELUDE_TYPES: [(&str, Symbol); 33] = [
|
|||
("Dec", Symbol::NUM_DEC),
|
||||
];
|
||||
|
||||
const MODULE_ENCODE_TYPES: &[(&str, Symbol)] = &[
|
||||
("Encoder", Symbol::ENCODE_ENCODER),
|
||||
("Encoding", Symbol::ENCODE_ENCODING),
|
||||
("EncoderFormatting", Symbol::ENCODE_ENCODERFORMATTING),
|
||||
];
|
||||
|
||||
macro_rules! log {
|
||||
($($arg:tt)*) => (dbg_do!(ROC_PRINT_LOAD_LOG, println!($($arg)*)))
|
||||
}
|
||||
|
@ -2248,6 +2256,12 @@ fn update<'a>(
|
|||
header
|
||||
.imported_modules
|
||||
.insert(ModuleId::ENCODE, Region::zero());
|
||||
|
||||
for (type_name, symbol) in MODULE_ENCODE_TYPES {
|
||||
header
|
||||
.exposed_imports
|
||||
.insert(Ident::from(*type_name), (*symbol, Region::zero()));
|
||||
}
|
||||
}
|
||||
|
||||
state
|
||||
|
|
|
@ -6494,7 +6494,7 @@ mod solve_expr {
|
|||
indoc!(
|
||||
r#"
|
||||
app "test"
|
||||
imports [Encode.{ Encoding, toEncoder }, Json]
|
||||
imports [Json]
|
||||
provides [main] to "./platform"
|
||||
|
||||
HelloWorld := {} has [Encoding {toEncoder}]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue