mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-03 00:24:34 +00:00
Remove Task from Roc
This commit is contained in:
parent
fbf448cac8
commit
2150ee2219
139 changed files with 337 additions and 14295 deletions
|
@ -15,7 +15,6 @@ use parking_lot::Mutex;
|
|||
use roc_builtins::roc::module_source;
|
||||
use roc_can::abilities::{AbilitiesStore, PendingAbilitiesStore, ResolvedImpl};
|
||||
use roc_can::constraint::{Constraint as ConstraintSoa, Constraints, TypeOrVar};
|
||||
use roc_can::env::FxMode;
|
||||
use roc_can::expr::{Declarations, ExpectLookup, PendingDerives};
|
||||
use roc_can::module::{
|
||||
canonicalize_module_defs, ExposedByModule, ExposedForModule, ExposedModuleTypes, Module,
|
||||
|
@ -34,7 +33,7 @@ use roc_debug_flags::{
|
|||
use roc_derive::SharedDerivedModule;
|
||||
use roc_error_macros::internal_error;
|
||||
use roc_late_solve::{AbilitiesView, WorldAbilities};
|
||||
use roc_module::ident::{Ident, IdentSuffix, ModuleName, QualifiedModuleName};
|
||||
use roc_module::ident::{Ident, ModuleName, QualifiedModuleName};
|
||||
use roc_module::symbol::{
|
||||
IdentIds, IdentIdsByModule, Interns, ModuleId, ModuleIds, PQModuleName, PackageModuleIds,
|
||||
PackageQualified, Symbol,
|
||||
|
@ -319,7 +318,6 @@ fn start_phase<'a>(
|
|||
exposed_module_ids: state.exposed_modules,
|
||||
exec_mode: state.exec_mode,
|
||||
imported_module_params,
|
||||
fx_mode: state.fx_mode,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -714,7 +712,6 @@ struct State<'a> {
|
|||
pub platform_path: PlatformPath<'a>,
|
||||
pub target: Target,
|
||||
pub(self) function_kind: FunctionKind,
|
||||
pub fx_mode: FxMode,
|
||||
|
||||
/// Note: only packages and platforms actually expose any modules;
|
||||
/// for all others, this will be empty.
|
||||
|
@ -802,7 +799,6 @@ impl<'a> State<'a> {
|
|||
cache_dir,
|
||||
target,
|
||||
function_kind,
|
||||
fx_mode: FxMode::Task,
|
||||
platform_data: None,
|
||||
platform_path: PlatformPath::NotSpecified,
|
||||
module_cache: ModuleCache::default(),
|
||||
|
@ -905,7 +901,6 @@ enum BuildTask<'a> {
|
|||
skip_constraint_gen: bool,
|
||||
exec_mode: ExecutionMode,
|
||||
imported_module_params: VecMap<ModuleId, ModuleParams>,
|
||||
fx_mode: FxMode,
|
||||
},
|
||||
Solve {
|
||||
module: Module,
|
||||
|
@ -2274,7 +2269,7 @@ fn update<'a>(
|
|||
config_shorthand,
|
||||
provides,
|
||||
exposes_ids,
|
||||
requires,
|
||||
requires: _,
|
||||
..
|
||||
} => {
|
||||
work.extend(state.dependencies.notify_package(config_shorthand));
|
||||
|
@ -2311,31 +2306,12 @@ fn update<'a>(
|
|||
if header.is_root_module {
|
||||
state.exposed_modules = exposes_ids;
|
||||
}
|
||||
|
||||
if requires.iter().any(|requires| {
|
||||
IdentSuffix::from_name(requires.value.ident.value).is_bang()
|
||||
}) {
|
||||
state.fx_mode = FxMode::PurityInference;
|
||||
}
|
||||
}
|
||||
Builtin { .. } => {
|
||||
if header.is_root_module {
|
||||
debug_assert!(matches!(state.platform_path, PlatformPath::NotSpecified));
|
||||
state.platform_path = PlatformPath::RootIsModule;
|
||||
}
|
||||
}
|
||||
Hosted { exposes, .. } | Module { exposes, .. } => {
|
||||
Builtin { .. } | Hosted { .. } | Module { .. } => {
|
||||
if header.is_root_module {
|
||||
debug_assert!(matches!(state.platform_path, PlatformPath::NotSpecified));
|
||||
state.platform_path = PlatformPath::RootIsHosted;
|
||||
}
|
||||
// WARNING: This will be bypassed if we export a record of effectful functions. This is a temporary hacky method
|
||||
if exposes
|
||||
.iter()
|
||||
.any(|exposed| exposed.value.is_effectful_fn())
|
||||
{
|
||||
state.fx_mode = FxMode::PurityInference;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2390,7 +2366,6 @@ fn update<'a>(
|
|||
extend_module_with_builtin_import(parsed, ModuleId::DECODE);
|
||||
extend_module_with_builtin_import(parsed, ModuleId::HASH);
|
||||
extend_module_with_builtin_import(parsed, ModuleId::INSPECT);
|
||||
extend_module_with_builtin_import(parsed, ModuleId::TASK);
|
||||
}
|
||||
state
|
||||
.module_cache
|
||||
|
@ -3711,7 +3686,6 @@ fn load_module<'a>(
|
|||
"Decode", ModuleId::DECODE
|
||||
"Hash", ModuleId::HASH
|
||||
"Inspect", ModuleId::INSPECT
|
||||
"Task", ModuleId::TASK
|
||||
}
|
||||
|
||||
let (filename, opt_shorthand) = module_name_to_path(src_dir, &module_name, arc_shorthands);
|
||||
|
@ -5121,7 +5095,6 @@ fn canonicalize_and_constrain<'a>(
|
|||
exposed_module_ids: &[ModuleId],
|
||||
exec_mode: ExecutionMode,
|
||||
imported_module_params: VecMap<ModuleId, ModuleParams>,
|
||||
fx_mode: FxMode,
|
||||
) -> CanAndCon {
|
||||
let canonicalize_start = Instant::now();
|
||||
|
||||
|
@ -5148,14 +5121,6 @@ fn canonicalize_and_constrain<'a>(
|
|||
|
||||
let mut var_store = VarStore::default();
|
||||
|
||||
let fx_mode = if module_id.is_builtin() {
|
||||
// Allow builtins to expose effectful functions
|
||||
// even if platform is `Task`-based
|
||||
FxMode::PurityInference
|
||||
} else {
|
||||
fx_mode
|
||||
};
|
||||
|
||||
let mut module_output = canonicalize_module_defs(
|
||||
arena,
|
||||
parsed_defs,
|
||||
|
@ -5173,7 +5138,6 @@ fn canonicalize_and_constrain<'a>(
|
|||
&symbols_from_requires,
|
||||
&mut var_store,
|
||||
opt_shorthand,
|
||||
fx_mode,
|
||||
);
|
||||
|
||||
let mut types = Types::new();
|
||||
|
@ -5285,7 +5249,6 @@ fn canonicalize_and_constrain<'a>(
|
|||
| ModuleId::SET
|
||||
| ModuleId::HASH
|
||||
| ModuleId::INSPECT
|
||||
| ModuleId::TASK
|
||||
);
|
||||
|
||||
if !name.is_builtin() || should_include_builtin {
|
||||
|
@ -6285,7 +6248,6 @@ fn run_task<'a>(
|
|||
exposed_module_ids,
|
||||
exec_mode,
|
||||
imported_module_params,
|
||||
fx_mode,
|
||||
} => {
|
||||
let can_and_con = canonicalize_and_constrain(
|
||||
arena,
|
||||
|
@ -6299,7 +6261,6 @@ fn run_task<'a>(
|
|||
exposed_module_ids,
|
||||
exec_mode,
|
||||
imported_module_params,
|
||||
fx_mode,
|
||||
);
|
||||
|
||||
Ok(Msg::CanonicalizedAndConstrained(can_and_con))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue