From 2351250b79656014eb441c39dc8c9a02cad1ee40 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Mon, 16 Jan 2023 18:10:26 -0400 Subject: Fixed bug wherein caching system couldn't handle changes to library/lux. --- .../library/lux/meta/compiler/default/platform.lux | 66 ++++++++++++++-------- .../jvm/function/field/constant/arity.lux | 20 +++++-- 2 files changed, 58 insertions(+), 28 deletions(-) (limited to 'stdlib/source/library') diff --git a/stdlib/source/library/lux/meta/compiler/default/platform.lux b/stdlib/source/library/lux/meta/compiler/default/platform.lux index 61115fb32..488e04e79 100644 --- a/stdlib/source/library/lux/meta/compiler/default/platform.lux +++ b/stdlib/source/library/lux/meta/compiler/default/platform.lux @@ -115,7 +115,8 @@ (-> context.Context module.ID (Key document) (Format document) (archive.Entry document) (Async (Try Any)))) (let [system (the #file_system platform) - write_artifact! (is (-> [artifact.ID (Maybe Text) Binary] (Action Any)) + write_artifact! (is (-> [artifact.ID (Maybe Text) Binary] + (Action Any)) (function (_ [artifact_id custom content]) (is (Async (Try Any)) (cache/artifact.cache! system context @module artifact_id content))))] @@ -152,7 +153,8 @@ ... TODO: Inline ASAP (def (compile_runtime! platform) (All (_ ) - (-> (///translation.Operation [Registry Output]))) + (-> + (///translation.Operation [Registry Output]))) (do phase.monad [_ ..initialize_buffer!] (the #runtime platform))) @@ -201,7 +203,8 @@ (//init.with_defaults .prelude all_extensions))) (def (with_extended_prelude state archive) - (-> Lux Archive Archive) + (-> Lux Archive + Archive) (|> (do try.monad [prelude (meta.result state (meta.module .prelude)) entry (archive.find .prelude archive) @@ -238,13 +241,14 @@ [archive analysis_state] (ioW.thaw (list) compilation_configuration (the #host platform) (the #file_system platform) context import compilation_sources) .let [with_missing_extensions (is (All (_ ) - (-> (//init.Extensions ) (Async (Try )))) + (-> (//init.Extensions ) + (Async (Try )))) (function (_ all_extensions state) (|> (initialize_state analysis_state all_extensions) (phase.result' state) (try#each product.left) async#in)))]] - (if (archive.archived? archive .prelude) + (if (archive.archived? archive descriptor.runtime) (do ! [state (with_missing_extensions all_extensions state) .let [archive (with_extended_prelude (the [///declaration.#analysis ///declaration.#state] state) archive)]] @@ -261,7 +265,8 @@ (def (module_compilation_log module) (All (_ ) - (-> descriptor.Module Text)) + (-> descriptor.Module + Text)) (|>> (the [///declaration.#translation ///declaration.#state ///translation.#log]) @@ -271,7 +276,8 @@ (def with_reset_log (All (_ ) - (-> )) + (-> + )) (has [///declaration.#translation ///declaration.#state ///translation.#log] @@ -296,8 +302,10 @@ #depended_by empty])) (def (depend module import dependence) - (-> descriptor.Module descriptor.Module Dependence Dependence) - (let [transitive_dependency (is (-> (-> Dependence Mapping) descriptor.Module (Set descriptor.Module)) + (-> descriptor.Module descriptor.Module Dependence + Dependence) + (let [transitive_dependency (is (-> (-> Dependence Mapping) descriptor.Module + (Set descriptor.Module)) (function (_ lens module) (|> dependence lens @@ -328,8 +336,10 @@ [import transitive_depended_by]))))) (def (circular_dependency? module import dependence) - (-> descriptor.Module descriptor.Module Dependence Bit) - (let [dependence? (is (-> descriptor.Module (-> Dependence Mapping) descriptor.Module Bit) + (-> descriptor.Module descriptor.Module Dependence + Bit) + (let [dependence? (is (-> descriptor.Module (-> Dependence Mapping) descriptor.Module + Bit) (function (_ from relationship to) (let [targets (|> dependence relationship @@ -357,7 +367,8 @@ ["Duplicates" (%.list %.text (set.list duplicates))]))) (def (verify_dependencies importer importee dependence) - (-> descriptor.Module descriptor.Module Dependence (Try Any)) + (-> descriptor.Module descriptor.Module Dependence + (Try Any)) (cond (text#= importer importee) (exception.except ..module_cannot_import_itself [importer]) @@ -384,10 +395,12 @@ (Signal state)]) (type (Importer state) - (-> (List ///.Custom) descriptor.Module descriptor.Module (Return state))) + (-> (List ///.Custom) descriptor.Module descriptor.Module + (Return state))) (type (Compiler state) - (-> (List ///.Custom) descriptor.Module (Importer state) module.ID (Context state) descriptor.Module (Return state))) + (-> (List ///.Custom) descriptor.Module (Importer state) module.ID (Context state) descriptor.Module + (Return state))) (with_expansions [Lux_Context (..Context ) Lux_Return (..Return ) @@ -398,7 +411,8 @@ (def (parallel initial) (All (_ ) (-> Lux_Context - (-> Lux_Compiler Lux_Importer))) + (-> Lux_Compiler + Lux_Importer))) (let [current (stm.var initial) pending (sharing [] (is Lux_Context @@ -489,7 +503,8 @@ ... TODO: Find a better way, as this only works for the Lux compiler. (def (updated_state archive extended_states state) (All (_ ) - (-> Archive (List ) (Try ))) + (-> Archive (List ) + (Try ))) (do [! try.monad] [modules (monad.each ! (function (_ module) (do ! @@ -503,10 +518,13 @@ (list#each product.left) (set.of_list text.hash)) with_modules (is (All (_ ) - (-> )) + (-> + )) (revised [///declaration.#analysis ///declaration.#state] - (is (All (_ a) (-> a a)) + (is (All (_ a) + (-> a + a)) (function (_ analysis_state) (|> analysis_state (as .Lux) @@ -521,7 +539,8 @@ (def (set_current_module module state) (All (_ ) - (-> descriptor.Module )) + (-> descriptor.Module + )) (|> (///declaration.set_current_module module) (phase.result' state) try.trusted @@ -531,7 +550,8 @@ ... This currently assumes that all imports will be specified once in a single .require form. ... This might not be the case in the future. (def (with_new_dependencies new_dependencies all_dependencies) - (-> (List descriptor.Module) (Set descriptor.Module) [(Set descriptor.Module) (Set descriptor.Module)]) + (-> (List descriptor.Module) (Set descriptor.Module) + [(Set descriptor.Module) (Set descriptor.Module)]) (let [[all_dependencies duplicates _] (is [(Set descriptor.Module) (Set descriptor.Module) Bit] (list#mix (function (_ new [all duplicates seen_prelude?]) (if (set.member? all new) @@ -620,7 +640,8 @@ state document) (-> Import context.Context (List _io.Context) Configuration (///.Compiler .Module) (Key document) (Format document) (///.Compilation state document) - (-> (List ///.Custom) descriptor.Module Lux_Importer module.ID (..Context state) descriptor.Module (..Return state)))) + (-> (List ///.Custom) descriptor.Module Lux_Importer module.ID (..Context state) descriptor.Module + (..Return state)))) (function (_ customs importer import! @module [archive state] module) (loop (again [[archive state] [archive state] compilation custom_compilation @@ -776,7 +797,8 @@ (def (custom import! it) (All (_ ) - (-> Lux_Importer compiler.Compiler (Async (Try [Lux_Context (List Text) Any])))) + (-> Lux_Importer compiler.Compiler + (Async (Try [Lux_Context (List Text) Any])))) (let [/#definition (the compiler.#definition it) [/#module /#name] /#definition] (do ..monad diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/translation/jvm/function/field/constant/arity.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/translation/jvm/function/field/constant/arity.lux index c798ee0c3..d379a48b3 100644 --- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/translation/jvm/function/field/constant/arity.lux +++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/translation/jvm/function/field/constant/arity.lux @@ -4,18 +4,26 @@ (.require [library [lux (.except type) + [math + [number + ["[0]" i64]]] [meta [compiler [target [jvm - ["[0]" type] - [constant - [pool (.only Resource)]]]]]]]] + ["[0]" type]]]]]]] ["[0]" // [///////// [arity (.only Arity)]]]) -(def .public minimum Arity 1) -(def .public maximum Arity 8) +(with_template [ ] + [(def .public + Arity + (i64.left_shifted 1))] -(def .public type type.int) + [0 minimum] + [3 maximum] + ) + +(def .public type + type.int) -- cgit v1.2.3