From 19973edfe80f70448a2dab9212ac131a3c505334 Mon Sep 17 00:00:00 2001 From: Louis Pilfold Date: Mon, 27 May 2024 23:44:06 +0100 Subject: [PATCH 1/8] Correctly detect Erlang collision --- CHANGELOG.md | 4 + compiler-core/src/build/package_loader.rs | 2591 +++++++++++---------- 2 files changed, 1302 insertions(+), 1293 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index db85a4dfd..43707032e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,3 +11,7 @@ ### Language Server ### Bug Fixes + +- Fixed a bug where the compiler could fail to detect modules that would clash + with Erlang modules. + ([Louis Pilfold](https://github.com/lpil)) diff --git a/compiler-core/src/build/package_loader.rs b/compiler-core/src/build/package_loader.rs index fca038e1d..05ce20c4d 100644 --- a/compiler-core/src/build/package_loader.rs +++ b/compiler-core/src/build/package_loader.rs @@ -224,7 +224,7 @@ where // This would most commonly happen for modules like "user" and // "code". Emit an error so this never happens. if self.target.is_erlang() { - ensure_gleam_module_does_not_overwrite_standard_erlang_module(&path)?; + self.ensure_gleam_module_does_not_overwrite_standard_erlang_module(&path)?; } let input = loader.load(path)?; @@ -262,1304 +262,1309 @@ where mtime, ) } -} -fn ensure_gleam_module_does_not_overwrite_standard_erlang_module(path: &Utf8Path) -> Result<()> { - let mut segments = path.iter(); - // Remove the first segement, which will be either `src/` or `test/` - let _ = segments.next(); + fn ensure_gleam_module_does_not_overwrite_standard_erlang_module( + &self, + path: &Utf8Path, + ) -> Result<()> { + let path = path.strip_prefix(self.root).unwrap_or(path); - let name = segments - .next() - .expect("There must always be a file name for a Gleam module"); + let mut segments = path.iter(); + // Remove the first segement, which will be either `src/` or `test/` + let _ = segments.next(); - // If there are remaining segments it means that this is a nested module and - // such cannot collide with a built-in Erlang module. - // - // For example, it could be the module `src/user/code.gleam` but could not - // be the module `src/code.gleam`. - if segments.next().is_some() { - return Ok(()); - } + let name = segments + .next() + .expect("There must always be a file name for a Gleam module"); - // Remove the .gleam extension, as this isn't part of the module name. - let name = name.trim_end_matches(".gleam"); + // If there are remaining segments it means that this is a nested module and + // such cannot collide with a built-in Erlang module. + // + // For example, it could be the module `src/user/code.gleam` but could not + // be the module `src/code.gleam`. + if segments.next().is_some() { + return Ok(()); + } - // If we got get here then it's not nested. Let's check if the name - // collides or not. - // - // These names were got with this Erlang - // - // ```erl - // file:write_file("names.txt", lists:join("\n",lists:map(fun(T) -> erlang:element(1, T) end, code:all_available()))). - // ``` - // - match name { - "alarm_handler" - | "application" - | "application_controller" - | "application_master" - | "application_starter" - | "appmon_info" - | "argparse" - | "array" - | "asn1_db" - | "asn1ct" - | "asn1ct_check" - | "asn1ct_constructed_ber_bin_v2" - | "asn1ct_constructed_per" - | "asn1ct_eval_ext" - | "asn1ct_func" - | "asn1ct_gen" - | "asn1ct_gen_ber_bin_v2" - | "asn1ct_gen_check" - | "asn1ct_gen_jer" - | "asn1ct_gen_per" - | "asn1ct_imm" - | "asn1ct_name" - | "asn1ct_parser2" - | "asn1ct_pretty_format" - | "asn1ct_rtt" - | "asn1ct_table" - | "asn1ct_tok" - | "asn1ct_value" - | "asn1rt_nif" - | "atomics" - | "auth" - | "base64" - | "beam_a" - | "beam_asm" - | "beam_block" - | "beam_bounds" - | "beam_call_types" - | "beam_clean" - | "beam_dict" - | "beam_digraph" - | "beam_disasm" - | "beam_flatten" - | "beam_jump" - | "beam_kernel_to_ssa" - | "beam_lib" - | "beam_listing" - | "beam_opcodes" - | "beam_ssa" - | "beam_ssa_alias" - | "beam_ssa_bc_size" - | "beam_ssa_bool" - | "beam_ssa_bsm" - | "beam_ssa_check" - | "beam_ssa_codegen" - | "beam_ssa_dead" - | "beam_ssa_lint" - | "beam_ssa_opt" - | "beam_ssa_pp" - | "beam_ssa_pre_codegen" - | "beam_ssa_private_append" - | "beam_ssa_recv" - | "beam_ssa_share" - | "beam_ssa_throw" - | "beam_ssa_type" - | "beam_trim" - | "beam_types" - | "beam_utils" - | "beam_validator" - | "beam_z" - | "binary" - | "c" - | "calendar" - | "cdv_atom_cb" - | "cdv_bin_cb" - | "cdv_detail_wx" - | "cdv_dist_cb" - | "cdv_ets_cb" - | "cdv_fun_cb" - | "cdv_gen_cb" - | "cdv_html_wx" - | "cdv_info_wx" - | "cdv_int_tab_cb" - | "cdv_mem_cb" - | "cdv_mod_cb" - | "cdv_multi_wx" - | "cdv_persistent_cb" - | "cdv_port_cb" - | "cdv_proc_cb" - | "cdv_sched_cb" - | "cdv_table_wx" - | "cdv_term_cb" - | "cdv_timer_cb" - | "cdv_virtual_list_wx" - | "cdv_wx" - | "cerl" - | "cerl_clauses" - | "cerl_inline" - | "cerl_prettypr" - | "cerl_trees" - | "code" - | "code_server" - | "compile" - | "core_lib" - | "core_lint" - | "core_parse" - | "core_pp" - | "core_scan" - | "counters" - | "cover" - | "cprof" - | "cpu_sup" - | "crashdump_viewer" - | "crypto" - | "crypto_ec_curves" - | "ct" - | "ct_config" - | "ct_config_plain" - | "ct_config_xml" - | "ct_conn_log_h" - | "ct_cover" - | "ct_default_gl" - | "ct_event" - | "ct_framework" - | "ct_ftp" - | "ct_gen_conn" - | "ct_groups" - | "ct_hooks" - | "ct_hooks_lock" - | "ct_logs" - | "ct_make" - | "ct_master" - | "ct_master_event" - | "ct_master_logs" - | "ct_master_status" - | "ct_netconfc" - | "ct_property_test" - | "ct_release_test" - | "ct_repeat" - | "ct_rpc" - | "ct_run" - | "ct_slave" - | "ct_snmp" - | "ct_ssh" - | "ct_suite" - | "ct_telnet" - | "ct_telnet_client" - | "ct_testspec" - | "ct_util" - | "cth_conn_log" - | "cth_log_redirect" - | "cth_surefire" - | "dbg" - | "dbg_debugged" - | "dbg_icmd" - | "dbg_idb" - | "dbg_ieval" - | "dbg_iload" - | "dbg_iserver" - | "dbg_istk" - | "dbg_wx_break" - | "dbg_wx_break_win" - | "dbg_wx_code" - | "dbg_wx_filedialog_win" - | "dbg_wx_interpret" - | "dbg_wx_mon" - | "dbg_wx_mon_win" - | "dbg_wx_settings" - | "dbg_wx_src_view" - | "dbg_wx_trace" - | "dbg_wx_trace_win" - | "dbg_wx_view" - | "dbg_wx_win" - | "dbg_wx_winman" - | "debugger" - | "dets" - | "dets_server" - | "dets_sup" - | "dets_utils" - | "dets_v9" - | "dialyzer" - | "dialyzer_analysis_callgraph" - | "dialyzer_behaviours" - | "dialyzer_callgraph" - | "dialyzer_cl" - | "dialyzer_cl_parse" - | "dialyzer_clean_core" - | "dialyzer_codeserver" - | "dialyzer_contracts" - | "dialyzer_coordinator" - | "dialyzer_cplt" - | "dialyzer_dataflow" - | "dialyzer_dep" - | "dialyzer_dot" - | "dialyzer_explanation" - | "dialyzer_gui_wx" - | "dialyzer_incremental" - | "dialyzer_iplt" - | "dialyzer_options" - | "dialyzer_plt" - | "dialyzer_succ_typings" - | "dialyzer_timing" - | "dialyzer_typegraph" - | "dialyzer_typesig" - | "dialyzer_utils" - | "dialyzer_worker" - | "diameter" - | "diameter_app" - | "diameter_callback" - | "diameter_capx" - | "diameter_codec" - | "diameter_codegen" - | "diameter_config" - | "diameter_config_sup" - | "diameter_dbg" - | "diameter_dict_parser" - | "diameter_dict_scanner" - | "diameter_dict_util" - | "diameter_dist" - | "diameter_etcp" - | "diameter_etcp_sup" - | "diameter_exprecs" - | "diameter_gen" - | "diameter_gen_acct_rfc6733" - | "diameter_gen_base_accounting" - | "diameter_gen_base_rfc3588" - | "diameter_gen_base_rfc6733" - | "diameter_gen_doic_rfc7683" - | "diameter_gen_relay" - | "diameter_info" - | "diameter_lib" - | "diameter_make" - | "diameter_misc_sup" - | "diameter_peer" - | "diameter_peer_fsm" - | "diameter_peer_fsm_sup" - | "diameter_reg" - | "diameter_sctp" - | "diameter_sctp_sup" - | "diameter_service" - | "diameter_service_sup" - | "diameter_session" - | "diameter_stats" - | "diameter_sup" - | "diameter_sync" - | "diameter_tcp" - | "diameter_tcp_sup" - | "diameter_traffic" - | "diameter_transport" - | "diameter_transport_sup" - | "diameter_types" - | "diameter_watchdog" - | "diameter_watchdog_sup" - | "dict" - | "digraph" - | "digraph_utils" - | "disk_log" - | "disk_log_1" - | "disk_log_server" - | "disk_log_sup" - | "disksup" - | "dist_ac" - | "dist_util" - | "docgen_edoc_xml_cb" - | "docgen_otp_specs" - | "docgen_xmerl_xml_cb" - | "docgen_xml_to_chunk" - | "dtls_connection" - | "dtls_connection_sup" - | "dtls_gen_connection" - | "dtls_handshake" - | "dtls_listener_sup" - | "dtls_packet_demux" - | "dtls_record" - | "dtls_server_session_cache_sup" - | "dtls_server_sup" - | "dtls_socket" - | "dtls_sup" - | "dtls_v1" - | "dyntrace" - | "edlin" - | "edlin_context" - | "edlin_expand" - | "edlin_key" - | "edlin_type_suggestion" - | "edoc" - | "edoc_cli" - | "edoc_data" - | "edoc_doclet" - | "edoc_doclet_chunks" - | "edoc_extract" - | "edoc_layout" - | "edoc_layout_chunks" - | "edoc_lib" - | "edoc_macros" - | "edoc_parser" - | "edoc_refs" - | "edoc_report" - | "edoc_run" - | "edoc_scanner" - | "edoc_specs" - | "edoc_tags" - | "edoc_types" - | "edoc_wiki" - | "eldap" - | "epp" - | "epp_dodger" - | "eprof" - | "erl2html2" - | "erl_abstract_code" - | "erl_anno" - | "erl_bif_types" - | "erl_bifs" - | "erl_bits" - | "erl_boot_server" - | "erl_comment_scan" - | "erl_compile" - | "erl_compile_server" - | "erl_ddll" - | "erl_distribution" - | "erl_epmd" - | "erl_error" - | "erl_erts_errors" - | "erl_eval" - | "erl_expand_records" - | "erl_features" - | "erl_init" - | "erl_internal" - | "erl_kernel_errors" - | "erl_lint" - | "erl_parse" - | "erl_posix_msg" - | "erl_pp" - | "erl_prettypr" - | "erl_prim_loader" - | "erl_recomment" - | "erl_reply" - | "erl_scan" - | "erl_signal_handler" - | "erl_stdlib_errors" - | "erl_syntax" - | "erl_syntax_lib" - | "erl_tar" - | "erl_tracer" - | "erl_types" - | "erlang" - | "erlsrv" - | "erpc" - | "error_handler" - | "error_logger" - | "error_logger_file_h" - | "error_logger_tty_h" - | "erts_alloc_config" - | "erts_code_purger" - | "erts_debug" - | "erts_dirty_process_signal_handler" - | "erts_internal" - | "erts_literal_area_collector" - | "escript" - | "et" - | "et_collector" - | "et_selector" - | "et_viewer" - | "et_wx_contents_viewer" - | "et_wx_viewer" - | "etop" - | "etop_tr" - | "etop_txt" - | "ets" - | "eunit" - | "eunit_autoexport" - | "eunit_data" - | "eunit_lib" - | "eunit_listener" - | "eunit_proc" - | "eunit_serial" - | "eunit_server" - | "eunit_striptests" - | "eunit_surefire" - | "eunit_test" - | "eunit_tests" - | "eunit_tty" - | "eval_bits" - | "file" - | "file_io_server" - | "file_server" - | "file_sorter" - | "filelib" - | "filename" - | "format_lib_supp" - | "fprof" - | "ftp" - | "ftp_app" - | "ftp_internal" - | "ftp_progress" - | "ftp_response" - | "ftp_sup" - | "gb_sets" - | "gb_trees" - | "gen" - | "gen_event" - | "gen_fsm" - | "gen_sctp" - | "gen_server" - | "gen_statem" - | "gen_tcp" - | "gen_tcp_socket" - | "gen_udp" - | "gen_udp_socket" - | "gl" - | "global" - | "global_group" - | "global_search" - | "glu" - | "group" - | "group_history" - | "heart" - | "http_chunk" - | "http_request" - | "http_response" - | "http_transport" - | "http_uri" - | "http_util" - | "httpc" - | "httpc_cookie" - | "httpc_handler" - | "httpc_handler_sup" - | "httpc_manager" - | "httpc_profile_sup" - | "httpc_request" - | "httpc_response" - | "httpc_sup" - | "httpd" - | "httpd_acceptor" - | "httpd_acceptor_sup" - | "httpd_cgi" - | "httpd_conf" - | "httpd_connection_sup" - | "httpd_custom" - | "httpd_custom_api" - | "httpd_esi" - | "httpd_example" - | "httpd_file" - | "httpd_instance_sup" - | "httpd_log" - | "httpd_logger" - | "httpd_manager" - | "httpd_misc_sup" - | "httpd_request" - | "httpd_request_handler" - | "httpd_response" - | "httpd_script_env" - | "httpd_socket" - | "httpd_sup" - | "httpd_util" - | "i" - | "inet" - | "inet6_sctp" - | "inet6_tcp" - | "inet6_tcp_dist" - | "inet6_tls_dist" - | "inet6_udp" - | "inet_config" - | "inet_db" - | "inet_dns" - | "inet_epmd_dist" - | "inet_epmd_socket" - | "inet_gethost_native" - | "inet_hosts" - | "inet_parse" - | "inet_res" - | "inet_sctp" - | "inet_tcp" - | "inet_tcp_dist" - | "inet_tls_dist" - | "inet_udp" - | "inets" - | "inets_app" - | "inets_lib" - | "inets_service" - | "inets_sup" - | "inets_trace" - | "init" - | "instrument" - | "int" - | "io" - | "io_lib" - | "io_lib_format" - | "io_lib_fread" - | "io_lib_pretty" - | "kernel" - | "kernel_config" - | "kernel_refc" - | "lcnt" - | "leex" - | "lists" - | "local_tcp" - | "local_udp" - | "log_mf_h" - | "logger" - | "logger_backend" - | "logger_config" - | "logger_disk_log_h" - | "logger_filters" - | "logger_formatter" - | "logger_h_common" - | "logger_handler_watcher" - | "logger_olp" - | "logger_proxy" - | "logger_server" - | "logger_simple_h" - | "logger_std_h" - | "logger_sup" - | "make" - | "maps" - | "math" - | "megaco" - | "megaco_ber_encoder" - | "megaco_ber_media_gateway_control_v1" - | "megaco_ber_media_gateway_control_v2" - | "megaco_ber_media_gateway_control_v3" - | "megaco_binary_encoder" - | "megaco_binary_encoder_lib" - | "megaco_binary_name_resolver_v1" - | "megaco_binary_name_resolver_v2" - | "megaco_binary_name_resolver_v3" - | "megaco_binary_term_id" - | "megaco_binary_term_id_gen" - | "megaco_binary_transformer_v1" - | "megaco_binary_transformer_v2" - | "megaco_binary_transformer_v3" - | "megaco_compact_text_encoder" - | "megaco_compact_text_encoder_v1" - | "megaco_compact_text_encoder_v2" - | "megaco_compact_text_encoder_v3" - | "megaco_config" - | "megaco_config_misc" - | "megaco_digit_map" - | "megaco_edist_compress" - | "megaco_encoder" - | "megaco_erl_dist_encoder" - | "megaco_erl_dist_encoder_mc" - | "megaco_filter" - | "megaco_flex_scanner" - | "megaco_flex_scanner_handler" - | "megaco_messenger" - | "megaco_messenger_misc" - | "megaco_misc_sup" - | "megaco_monitor" - | "megaco_per_encoder" - | "megaco_per_media_gateway_control_v1" - | "megaco_per_media_gateway_control_v2" - | "megaco_per_media_gateway_control_v3" - | "megaco_pretty_text_encoder" - | "megaco_pretty_text_encoder_v1" - | "megaco_pretty_text_encoder_v2" - | "megaco_pretty_text_encoder_v3" - | "megaco_sdp" - | "megaco_stats" - | "megaco_sup" - | "megaco_tcp" - | "megaco_tcp_accept" - | "megaco_tcp_accept_sup" - | "megaco_tcp_connection" - | "megaco_tcp_connection_sup" - | "megaco_tcp_sup" - | "megaco_text_mini_decoder" - | "megaco_text_mini_parser" - | "megaco_text_parser_v1" - | "megaco_text_parser_v2" - | "megaco_text_parser_v3" - | "megaco_text_scanner" - | "megaco_timer" - | "megaco_trans_sender" - | "megaco_trans_sup" - | "megaco_transport" - | "megaco_udp" - | "megaco_udp_server" - | "megaco_udp_sup" - | "megaco_user" - | "megaco_user_default" - | "memsup" - | "merl" - | "merl_transform" - | "misc_supp" - | "mnesia" - | "mnesia_app" - | "mnesia_backend_type" - | "mnesia_backup" - | "mnesia_bup" - | "mnesia_checkpoint" - | "mnesia_checkpoint_sup" - | "mnesia_controller" - | "mnesia_dumper" - | "mnesia_event" - | "mnesia_ext_sup" - | "mnesia_frag" - | "mnesia_frag_hash" - | "mnesia_index" - | "mnesia_kernel_sup" - | "mnesia_late_loader" - | "mnesia_lib" - | "mnesia_loader" - | "mnesia_locker" - | "mnesia_log" - | "mnesia_monitor" - | "mnesia_recover" - | "mnesia_registry" - | "mnesia_rpc" - | "mnesia_schema" - | "mnesia_snmp_hook" - | "mnesia_sp" - | "mnesia_subscr" - | "mnesia_sup" - | "mnesia_text" - | "mnesia_tm" - | "mod_actions" - | "mod_alias" - | "mod_auth" - | "mod_auth_dets" - | "mod_auth_mnesia" - | "mod_auth_plain" - | "mod_auth_server" - | "mod_cgi" - | "mod_dir" - | "mod_disk_log" - | "mod_esi" - | "mod_get" - | "mod_head" - | "mod_log" - | "mod_range" - | "mod_responsecontrol" - | "mod_security" - | "mod_security_server" - | "mod_trace" - | "ms_transform" - | "msacc" - | "net" - | "net_adm" - | "net_kernel" - | "nteventlog" - | "observer" - | "observer_alloc_wx" - | "observer_app_wx" - | "observer_backend" - | "observer_html_lib" - | "observer_lib" - | "observer_perf_wx" - | "observer_port_wx" - | "observer_pro_wx" - | "observer_procinfo" - | "observer_sock_wx" - | "observer_sys_wx" - | "observer_trace_wx" - | "observer_traceoptions_wx" - | "observer_tv_table" - | "observer_tv_wx" - | "observer_wx" - | "orddict" - | "ordsets" - | "os" - | "os_mon" - | "os_mon_mib" - | "os_mon_sysinfo" - | "os_sup" - | "otp_internal" - | "peer" - | "persistent_term" - | "pg" - | "pg2" - | "pool" - | "prettypr" - | "prim_buffer" - | "prim_eval" - | "prim_file" - | "prim_inet" - | "prim_net" - | "prim_socket" - | "prim_tty" - | "prim_zip" - | "proc_lib" - | "proplists" - | "pubkey_cert" - | "pubkey_cert_records" - | "pubkey_crl" - | "pubkey_ocsp" - | "pubkey_os_cacerts" - | "pubkey_pbe" - | "pubkey_pem" - | "pubkey_policy_tree" - | "pubkey_ssh" - | "public_key" - | "qlc" - | "qlc_pt" - | "queue" - | "ram_file" - | "rand" - | "random" - | "raw_file_io" - | "raw_file_io_compressed" - | "raw_file_io_deflate" - | "raw_file_io_delayed" - | "raw_file_io_inflate" - | "raw_file_io_list" - | "rb" - | "rb_format_supp" - | "re" - | "rec_env" - | "release_handler" - | "release_handler_1" - | "reltool" - | "reltool_app_win" - | "reltool_fgraph" - | "reltool_fgraph_win" - | "reltool_mod_win" - | "reltool_server" - | "reltool_sys_win" - | "reltool_target" - | "reltool_utils" - | "rpc" - | "runtime_tools" - | "runtime_tools_sup" - | "sasl" - | "sasl_report" - | "sasl_report_file_h" - | "sasl_report_tty_h" - | "scheduler" - | "seq_trace" - | "sets" - | "shell" - | "shell_default" - | "shell_docs" - | "slave" - | "snmp" - | "snmp_app" - | "snmp_app_sup" - | "snmp_community_mib" - | "snmp_conf" - | "snmp_config" - | "snmp_framework_mib" - | "snmp_generic" - | "snmp_generic_mnesia" - | "snmp_index" - | "snmp_log" - | "snmp_mini_mib" - | "snmp_misc" - | "snmp_note_store" - | "snmp_notification_mib" - | "snmp_pdus" - | "snmp_shadow_table" - | "snmp_standard_mib" - | "snmp_target_mib" - | "snmp_user_based_sm_mib" - | "snmp_usm" - | "snmp_verbosity" - | "snmp_view_based_acm_mib" - | "snmpa" - | "snmpa_acm" - | "snmpa_agent" - | "snmpa_agent_sup" - | "snmpa_app" - | "snmpa_authentication_service" - | "snmpa_conf" - | "snmpa_discovery_handler" - | "snmpa_discovery_handler_default" - | "snmpa_error" - | "snmpa_error_io" - | "snmpa_error_logger" - | "snmpa_error_report" - | "snmpa_get" - | "snmpa_get_lib" - | "snmpa_get_mechanism" - | "snmpa_local_db" - | "snmpa_mib" - | "snmpa_mib_data" - | "snmpa_mib_data_tttn" - | "snmpa_mib_lib" - | "snmpa_mib_storage" - | "snmpa_mib_storage_dets" - | "snmpa_mib_storage_ets" - | "snmpa_mib_storage_mnesia" - | "snmpa_misc_sup" - | "snmpa_mpd" - | "snmpa_net_if" - | "snmpa_net_if_filter" - | "snmpa_network_interface" - | "snmpa_network_interface_filter" - | "snmpa_notification_delivery_info_receiver" - | "snmpa_notification_filter" - | "snmpa_set" - | "snmpa_set_lib" - | "snmpa_set_mechanism" - | "snmpa_supervisor" - | "snmpa_svbl" - | "snmpa_symbolic_store" - | "snmpa_target_cache" - | "snmpa_trap" - | "snmpa_usm" - | "snmpa_vacm" - | "snmpc" - | "snmpc_lib" - | "snmpc_mib_gram" - | "snmpc_mib_to_hrl" - | "snmpc_misc" - | "snmpc_tok" - | "snmpm" - | "snmpm_conf" - | "snmpm_config" - | "snmpm_misc_sup" - | "snmpm_mpd" - | "snmpm_net_if" - | "snmpm_net_if_filter" - | "snmpm_net_if_mt" - | "snmpm_network_interface" - | "snmpm_network_interface_filter" - | "snmpm_server" - | "snmpm_server_sup" - | "snmpm_supervisor" - | "snmpm_user" - | "snmpm_user_default" - | "snmpm_user_old" - | "snmpm_usm" - | "socket" - | "socket_registry" - | "sofs" - | "ssh" - | "ssh_acceptor" - | "ssh_acceptor_sup" - | "ssh_agent" - | "ssh_app" - | "ssh_auth" - | "ssh_bits" - | "ssh_channel" - | "ssh_channel_sup" - | "ssh_cli" - | "ssh_client_channel" - | "ssh_client_key_api" - | "ssh_connection" - | "ssh_connection_handler" - | "ssh_daemon_channel" - | "ssh_dbg" - | "ssh_file" - | "ssh_fsm_kexinit" - | "ssh_fsm_userauth_client" - | "ssh_fsm_userauth_server" - | "ssh_info" - | "ssh_io" - | "ssh_lib" - | "ssh_message" - | "ssh_no_io" - | "ssh_options" - | "ssh_server_channel" - | "ssh_server_key_api" - | "ssh_sftp" - | "ssh_sftpd" - | "ssh_sftpd_file" - | "ssh_sftpd_file_api" - | "ssh_shell" - | "ssh_subsystem_sup" - | "ssh_system_sup" - | "ssh_tcpip_forward_acceptor" - | "ssh_tcpip_forward_acceptor_sup" - | "ssh_tcpip_forward_client" - | "ssh_tcpip_forward_srv" - | "ssh_transport" - | "ssh_xfer" - | "ssl" - | "ssl_admin_sup" - | "ssl_alert" - | "ssl_app" - | "ssl_certificate" - | "ssl_cipher" - | "ssl_cipher_format" - | "ssl_client_session_cache_db" - | "ssl_config" - | "ssl_connection_sup" - | "ssl_crl" - | "ssl_crl_cache" - | "ssl_crl_cache_api" - | "ssl_crl_hash_dir" - | "ssl_dh_groups" - | "ssl_dist_admin_sup" - | "ssl_dist_connection_sup" - | "ssl_dist_sup" - | "ssl_gen_statem" - | "ssl_handshake" - | "ssl_listen_tracker_sup" - | "ssl_logger" - | "ssl_manager" - | "ssl_pem_cache" - | "ssl_pkix_db" - | "ssl_record" - | "ssl_server_session_cache" - | "ssl_server_session_cache_db" - | "ssl_server_session_cache_sup" - | "ssl_session" - | "ssl_session_cache_api" - | "ssl_srp_primes" - | "ssl_sup" - | "ssl_trace" - | "ssl_upgrade_server_session_cache_sup" - | "standard_error" - | "string" - | "supervisor" - | "supervisor_bridge" - | "sys" - | "sys_core_alias" - | "sys_core_bsm" - | "sys_core_fold" - | "sys_core_fold_lists" - | "sys_core_inline" - | "sys_core_prepare" - | "sys_messages" - | "sys_pre_attributes" - | "system_information" - | "systools" - | "systools_lib" - | "systools_make" - | "systools_rc" - | "systools_relup" - | "tags" - | "test_server" - | "test_server_ctrl" - | "test_server_gl" - | "test_server_io" - | "test_server_node" - | "test_server_sup" - | "tftp" - | "tftp_app" - | "tftp_binary" - | "tftp_engine" - | "tftp_file" - | "tftp_lib" - | "tftp_logger" - | "tftp_sup" - | "timer" - | "tls_bloom_filter" - | "tls_client_connection_1_3" - | "tls_client_ticket_store" - | "tls_connection" - | "tls_connection_sup" - | "tls_dist_server_sup" - | "tls_dist_sup" - | "tls_dtls_connection" - | "tls_dyn_connection_sup" - | "tls_gen_connection" - | "tls_gen_connection_1_3" - | "tls_handshake" - | "tls_handshake_1_3" - | "tls_record" - | "tls_record_1_3" - | "tls_sender" - | "tls_server_connection_1_3" - | "tls_server_session_ticket" - | "tls_server_session_ticket_sup" - | "tls_server_sup" - | "tls_socket" - | "tls_sup" - | "tls_v1" - | "ttb" - | "ttb_autostart" - | "ttb_et" - | "typer" - | "typer_core" - | "unicode" - | "unicode_util" - | "unix_telnet" - | "uri_string" - | "user_drv" - | "user_sup" - | "v3_core" - | "v3_kernel" - | "v3_kernel_pp" - | "win32reg" - | "wrap_log_reader" - | "wx" - | "wxAcceleratorEntry" - | "wxAcceleratorTable" - | "wxActivateEvent" - | "wxArtProvider" - | "wxAuiDockArt" - | "wxAuiManager" - | "wxAuiManagerEvent" - | "wxAuiNotebook" - | "wxAuiNotebookEvent" - | "wxAuiPaneInfo" - | "wxAuiSimpleTabArt" - | "wxAuiTabArt" - | "wxBitmap" - | "wxBitmapButton" - | "wxBitmapDataObject" - | "wxBookCtrlBase" - | "wxBookCtrlEvent" - | "wxBoxSizer" - | "wxBrush" - | "wxBufferedDC" - | "wxBufferedPaintDC" - | "wxButton" - | "wxCalendarCtrl" - | "wxCalendarDateAttr" - | "wxCalendarEvent" - | "wxCaret" - | "wxCheckBox" - | "wxCheckListBox" - | "wxChildFocusEvent" - | "wxChoice" - | "wxChoicebook" - | "wxClientDC" - | "wxClipboard" - | "wxClipboardTextEvent" - | "wxCloseEvent" - | "wxColourData" - | "wxColourDialog" - | "wxColourPickerCtrl" - | "wxColourPickerEvent" - | "wxComboBox" - | "wxCommandEvent" - | "wxContextMenuEvent" - | "wxControl" - | "wxControlWithItems" - | "wxCursor" - | "wxDC" - | "wxDCOverlay" - | "wxDataObject" - | "wxDateEvent" - | "wxDatePickerCtrl" - | "wxDialog" - | "wxDirDialog" - | "wxDirPickerCtrl" - | "wxDisplay" - | "wxDisplayChangedEvent" - | "wxDropFilesEvent" - | "wxEraseEvent" - | "wxEvent" - | "wxEvtHandler" - | "wxFileDataObject" - | "wxFileDialog" - | "wxFileDirPickerEvent" - | "wxFilePickerCtrl" - | "wxFindReplaceData" - | "wxFindReplaceDialog" - | "wxFlexGridSizer" - | "wxFocusEvent" - | "wxFont" - | "wxFontData" - | "wxFontDialog" - | "wxFontPickerCtrl" - | "wxFontPickerEvent" - | "wxFrame" - | "wxGBSizerItem" - | "wxGCDC" - | "wxGLCanvas" - | "wxGLContext" - | "wxGauge" - | "wxGenericDirCtrl" - | "wxGraphicsBrush" - | "wxGraphicsContext" - | "wxGraphicsFont" - | "wxGraphicsGradientStops" - | "wxGraphicsMatrix" - | "wxGraphicsObject" - | "wxGraphicsPath" - | "wxGraphicsPen" - | "wxGraphicsRenderer" - | "wxGrid" - | "wxGridBagSizer" - | "wxGridCellAttr" - | "wxGridCellBoolEditor" - | "wxGridCellBoolRenderer" - | "wxGridCellChoiceEditor" - | "wxGridCellEditor" - | "wxGridCellFloatEditor" - | "wxGridCellFloatRenderer" - | "wxGridCellNumberEditor" - | "wxGridCellNumberRenderer" - | "wxGridCellRenderer" - | "wxGridCellStringRenderer" - | "wxGridCellTextEditor" - | "wxGridEvent" - | "wxGridSizer" - | "wxHelpEvent" - | "wxHtmlEasyPrinting" - | "wxHtmlLinkEvent" - | "wxHtmlWindow" - | "wxIcon" - | "wxIconBundle" - | "wxIconizeEvent" - | "wxIdleEvent" - | "wxImage" - | "wxImageList" - | "wxInitDialogEvent" - | "wxJoystickEvent" - | "wxKeyEvent" - | "wxLayoutAlgorithm" - | "wxListBox" - | "wxListCtrl" - | "wxListEvent" - | "wxListItem" - | "wxListItemAttr" - | "wxListView" - | "wxListbook" - | "wxLocale" - | "wxLogNull" - | "wxMDIChildFrame" - | "wxMDIClientWindow" - | "wxMDIParentFrame" - | "wxMask" - | "wxMaximizeEvent" - | "wxMemoryDC" - | "wxMenu" - | "wxMenuBar" - | "wxMenuEvent" - | "wxMenuItem" - | "wxMessageDialog" - | "wxMiniFrame" - | "wxMirrorDC" - | "wxMouseCaptureChangedEvent" - | "wxMouseCaptureLostEvent" - | "wxMouseEvent" - | "wxMoveEvent" - | "wxMultiChoiceDialog" - | "wxNavigationKeyEvent" - | "wxNotebook" - | "wxNotificationMessage" - | "wxNotifyEvent" - | "wxOverlay" - | "wxPageSetupDialog" - | "wxPageSetupDialogData" - | "wxPaintDC" - | "wxPaintEvent" - | "wxPalette" - | "wxPaletteChangedEvent" - | "wxPanel" - | "wxPasswordEntryDialog" - | "wxPen" - | "wxPickerBase" - | "wxPopupTransientWindow" - | "wxPopupWindow" - | "wxPostScriptDC" - | "wxPreviewCanvas" - | "wxPreviewControlBar" - | "wxPreviewFrame" - | "wxPrintData" - | "wxPrintDialog" - | "wxPrintDialogData" - | "wxPrintPreview" - | "wxPrinter" - | "wxPrintout" - | "wxProgressDialog" - | "wxQueryNewPaletteEvent" - | "wxRadioBox" - | "wxRadioButton" - | "wxRegion" - | "wxSashEvent" - | "wxSashLayoutWindow" - | "wxSashWindow" - | "wxScreenDC" - | "wxScrollBar" - | "wxScrollEvent" - | "wxScrollWinEvent" - | "wxScrolledWindow" - | "wxSetCursorEvent" - | "wxShowEvent" - | "wxSingleChoiceDialog" - | "wxSizeEvent" - | "wxSizer" - | "wxSizerFlags" - | "wxSizerItem" - | "wxSlider" - | "wxSpinButton" - | "wxSpinCtrl" - | "wxSpinEvent" - | "wxSplashScreen" - | "wxSplitterEvent" - | "wxSplitterWindow" - | "wxStaticBitmap" - | "wxStaticBox" - | "wxStaticBoxSizer" - | "wxStaticLine" - | "wxStaticText" - | "wxStatusBar" - | "wxStdDialogButtonSizer" - | "wxStyledTextCtrl" - | "wxStyledTextEvent" - | "wxSysColourChangedEvent" - | "wxSystemOptions" - | "wxSystemSettings" - | "wxTaskBarIcon" - | "wxTaskBarIconEvent" - | "wxTextAttr" - | "wxTextCtrl" - | "wxTextDataObject" - | "wxTextEntryDialog" - | "wxToggleButton" - | "wxToolBar" - | "wxToolTip" - | "wxToolbook" - | "wxTopLevelWindow" - | "wxTreeCtrl" - | "wxTreeEvent" - | "wxTreebook" - | "wxUpdateUIEvent" - | "wxWebView" - | "wxWebViewEvent" - | "wxWindow" - | "wxWindowCreateEvent" - | "wxWindowDC" - | "wxWindowDestroyEvent" - | "wxXmlResource" - | "wx_misc" - | "wx_object" - | "wxe_master" - | "wxe_server" - | "wxe_util" - | "xmerl" - | "xmerl_b64Bin" - | "xmerl_b64Bin_scan" - | "xmerl_eventp" - | "xmerl_html" - | "xmerl_lib" - | "xmerl_otpsgml" - | "xmerl_regexp" - | "xmerl_sax_old_dom" - | "xmerl_sax_parser" - | "xmerl_sax_parser_latin1" - | "xmerl_sax_parser_list" - | "xmerl_sax_parser_utf16be" - | "xmerl_sax_parser_utf16le" - | "xmerl_sax_parser_utf8" - | "xmerl_sax_simple_dom" - | "xmerl_scan" - | "xmerl_sgml" - | "xmerl_simple" - | "xmerl_text" - | "xmerl_ucs" - | "xmerl_uri" - | "xmerl_validate" - | "xmerl_xlate" - | "xmerl_xml" - | "xmerl_xpath" - | "xmerl_xpath_lib" - | "xmerl_xpath_parse" - | "xmerl_xpath_pred" - | "xmerl_xpath_scan" - | "xmerl_xs" - | "xmerl_xsd" - | "xmerl_xsd_type" - | "xref" - | "xref_base" - | "xref_compiler" - | "xref_parser" - | "xref_reader" - | "xref_scanner" - | "xref_utils" - | "yecc" - | "yeccparser" - | "yeccscan" - | "zip" - | "zlib" => (), - _ => return Ok(()), - } + // Remove the .gleam extension, as this isn't part of the module name. + let name = name.trim_end_matches(".gleam"); - Err(Error::GleamModuleWouldOverwriteStandardErlangModule { - name: name.into(), - path: path.to_owned(), - }) + // If we got get here then it's not nested. Let's check if the name + // collides or not. + // + // These names were got with this Erlang + // + // ```erl + // file:write_file("names.txt", lists:join("\n",lists:map(fun(T) -> erlang:element(1, T) end, code:all_available()))). + // ``` + // + match name { + "alarm_handler" + | "application" + | "application_controller" + | "application_master" + | "application_starter" + | "appmon_info" + | "argparse" + | "array" + | "asn1_db" + | "asn1ct" + | "asn1ct_check" + | "asn1ct_constructed_ber_bin_v2" + | "asn1ct_constructed_per" + | "asn1ct_eval_ext" + | "asn1ct_func" + | "asn1ct_gen" + | "asn1ct_gen_ber_bin_v2" + | "asn1ct_gen_check" + | "asn1ct_gen_jer" + | "asn1ct_gen_per" + | "asn1ct_imm" + | "asn1ct_name" + | "asn1ct_parser2" + | "asn1ct_pretty_format" + | "asn1ct_rtt" + | "asn1ct_table" + | "asn1ct_tok" + | "asn1ct_value" + | "asn1rt_nif" + | "atomics" + | "auth" + | "base64" + | "beam_a" + | "beam_asm" + | "beam_block" + | "beam_bounds" + | "beam_call_types" + | "beam_clean" + | "beam_dict" + | "beam_digraph" + | "beam_disasm" + | "beam_flatten" + | "beam_jump" + | "beam_kernel_to_ssa" + | "beam_lib" + | "beam_listing" + | "beam_opcodes" + | "beam_ssa" + | "beam_ssa_alias" + | "beam_ssa_bc_size" + | "beam_ssa_bool" + | "beam_ssa_bsm" + | "beam_ssa_check" + | "beam_ssa_codegen" + | "beam_ssa_dead" + | "beam_ssa_lint" + | "beam_ssa_opt" + | "beam_ssa_pp" + | "beam_ssa_pre_codegen" + | "beam_ssa_private_append" + | "beam_ssa_recv" + | "beam_ssa_share" + | "beam_ssa_throw" + | "beam_ssa_type" + | "beam_trim" + | "beam_types" + | "beam_utils" + | "beam_validator" + | "beam_z" + | "binary" + | "c" + | "calendar" + | "cdv_atom_cb" + | "cdv_bin_cb" + | "cdv_detail_wx" + | "cdv_dist_cb" + | "cdv_ets_cb" + | "cdv_fun_cb" + | "cdv_gen_cb" + | "cdv_html_wx" + | "cdv_info_wx" + | "cdv_int_tab_cb" + | "cdv_mem_cb" + | "cdv_mod_cb" + | "cdv_multi_wx" + | "cdv_persistent_cb" + | "cdv_port_cb" + | "cdv_proc_cb" + | "cdv_sched_cb" + | "cdv_table_wx" + | "cdv_term_cb" + | "cdv_timer_cb" + | "cdv_virtual_list_wx" + | "cdv_wx" + | "cerl" + | "cerl_clauses" + | "cerl_inline" + | "cerl_prettypr" + | "cerl_trees" + | "code" + | "code_server" + | "compile" + | "core_lib" + | "core_lint" + | "core_parse" + | "core_pp" + | "core_scan" + | "counters" + | "cover" + | "cprof" + | "cpu_sup" + | "crashdump_viewer" + | "crypto" + | "crypto_ec_curves" + | "ct" + | "ct_config" + | "ct_config_plain" + | "ct_config_xml" + | "ct_conn_log_h" + | "ct_cover" + | "ct_default_gl" + | "ct_event" + | "ct_framework" + | "ct_ftp" + | "ct_gen_conn" + | "ct_groups" + | "ct_hooks" + | "ct_hooks_lock" + | "ct_logs" + | "ct_make" + | "ct_master" + | "ct_master_event" + | "ct_master_logs" + | "ct_master_status" + | "ct_netconfc" + | "ct_property_test" + | "ct_release_test" + | "ct_repeat" + | "ct_rpc" + | "ct_run" + | "ct_slave" + | "ct_snmp" + | "ct_ssh" + | "ct_suite" + | "ct_telnet" + | "ct_telnet_client" + | "ct_testspec" + | "ct_util" + | "cth_conn_log" + | "cth_log_redirect" + | "cth_surefire" + | "dbg" + | "dbg_debugged" + | "dbg_icmd" + | "dbg_idb" + | "dbg_ieval" + | "dbg_iload" + | "dbg_iserver" + | "dbg_istk" + | "dbg_wx_break" + | "dbg_wx_break_win" + | "dbg_wx_code" + | "dbg_wx_filedialog_win" + | "dbg_wx_interpret" + | "dbg_wx_mon" + | "dbg_wx_mon_win" + | "dbg_wx_settings" + | "dbg_wx_src_view" + | "dbg_wx_trace" + | "dbg_wx_trace_win" + | "dbg_wx_view" + | "dbg_wx_win" + | "dbg_wx_winman" + | "debugger" + | "dets" + | "dets_server" + | "dets_sup" + | "dets_utils" + | "dets_v9" + | "dialyzer" + | "dialyzer_analysis_callgraph" + | "dialyzer_behaviours" + | "dialyzer_callgraph" + | "dialyzer_cl" + | "dialyzer_cl_parse" + | "dialyzer_clean_core" + | "dialyzer_codeserver" + | "dialyzer_contracts" + | "dialyzer_coordinator" + | "dialyzer_cplt" + | "dialyzer_dataflow" + | "dialyzer_dep" + | "dialyzer_dot" + | "dialyzer_explanation" + | "dialyzer_gui_wx" + | "dialyzer_incremental" + | "dialyzer_iplt" + | "dialyzer_options" + | "dialyzer_plt" + | "dialyzer_succ_typings" + | "dialyzer_timing" + | "dialyzer_typegraph" + | "dialyzer_typesig" + | "dialyzer_utils" + | "dialyzer_worker" + | "diameter" + | "diameter_app" + | "diameter_callback" + | "diameter_capx" + | "diameter_codec" + | "diameter_codegen" + | "diameter_config" + | "diameter_config_sup" + | "diameter_dbg" + | "diameter_dict_parser" + | "diameter_dict_scanner" + | "diameter_dict_util" + | "diameter_dist" + | "diameter_etcp" + | "diameter_etcp_sup" + | "diameter_exprecs" + | "diameter_gen" + | "diameter_gen_acct_rfc6733" + | "diameter_gen_base_accounting" + | "diameter_gen_base_rfc3588" + | "diameter_gen_base_rfc6733" + | "diameter_gen_doic_rfc7683" + | "diameter_gen_relay" + | "diameter_info" + | "diameter_lib" + | "diameter_make" + | "diameter_misc_sup" + | "diameter_peer" + | "diameter_peer_fsm" + | "diameter_peer_fsm_sup" + | "diameter_reg" + | "diameter_sctp" + | "diameter_sctp_sup" + | "diameter_service" + | "diameter_service_sup" + | "diameter_session" + | "diameter_stats" + | "diameter_sup" + | "diameter_sync" + | "diameter_tcp" + | "diameter_tcp_sup" + | "diameter_traffic" + | "diameter_transport" + | "diameter_transport_sup" + | "diameter_types" + | "diameter_watchdog" + | "diameter_watchdog_sup" + | "dict" + | "digraph" + | "digraph_utils" + | "disk_log" + | "disk_log_1" + | "disk_log_server" + | "disk_log_sup" + | "disksup" + | "dist_ac" + | "dist_util" + | "docgen_edoc_xml_cb" + | "docgen_otp_specs" + | "docgen_xmerl_xml_cb" + | "docgen_xml_to_chunk" + | "dtls_connection" + | "dtls_connection_sup" + | "dtls_gen_connection" + | "dtls_handshake" + | "dtls_listener_sup" + | "dtls_packet_demux" + | "dtls_record" + | "dtls_server_session_cache_sup" + | "dtls_server_sup" + | "dtls_socket" + | "dtls_sup" + | "dtls_v1" + | "dyntrace" + | "edlin" + | "edlin_context" + | "edlin_expand" + | "edlin_key" + | "edlin_type_suggestion" + | "edoc" + | "edoc_cli" + | "edoc_data" + | "edoc_doclet" + | "edoc_doclet_chunks" + | "edoc_extract" + | "edoc_layout" + | "edoc_layout_chunks" + | "edoc_lib" + | "edoc_macros" + | "edoc_parser" + | "edoc_refs" + | "edoc_report" + | "edoc_run" + | "edoc_scanner" + | "edoc_specs" + | "edoc_tags" + | "edoc_types" + | "edoc_wiki" + | "eldap" + | "epp" + | "epp_dodger" + | "eprof" + | "erl2html2" + | "erl_abstract_code" + | "erl_anno" + | "erl_bif_types" + | "erl_bifs" + | "erl_bits" + | "erl_boot_server" + | "erl_comment_scan" + | "erl_compile" + | "erl_compile_server" + | "erl_ddll" + | "erl_distribution" + | "erl_epmd" + | "erl_error" + | "erl_erts_errors" + | "erl_eval" + | "erl_expand_records" + | "erl_features" + | "erl_init" + | "erl_internal" + | "erl_kernel_errors" + | "erl_lint" + | "erl_parse" + | "erl_posix_msg" + | "erl_pp" + | "erl_prettypr" + | "erl_prim_loader" + | "erl_recomment" + | "erl_reply" + | "erl_scan" + | "erl_signal_handler" + | "erl_stdlib_errors" + | "erl_syntax" + | "erl_syntax_lib" + | "erl_tar" + | "erl_tracer" + | "erl_types" + | "erlang" + | "erlsrv" + | "erpc" + | "error_handler" + | "error_logger" + | "error_logger_file_h" + | "error_logger_tty_h" + | "erts_alloc_config" + | "erts_code_purger" + | "erts_debug" + | "erts_dirty_process_signal_handler" + | "erts_internal" + | "erts_literal_area_collector" + | "escript" + | "et" + | "et_collector" + | "et_selector" + | "et_viewer" + | "et_wx_contents_viewer" + | "et_wx_viewer" + | "etop" + | "etop_tr" + | "etop_txt" + | "ets" + | "eunit" + | "eunit_autoexport" + | "eunit_data" + | "eunit_lib" + | "eunit_listener" + | "eunit_proc" + | "eunit_serial" + | "eunit_server" + | "eunit_striptests" + | "eunit_surefire" + | "eunit_test" + | "eunit_tests" + | "eunit_tty" + | "eval_bits" + | "file" + | "file_io_server" + | "file_server" + | "file_sorter" + | "filelib" + | "filename" + | "format_lib_supp" + | "fprof" + | "ftp" + | "ftp_app" + | "ftp_internal" + | "ftp_progress" + | "ftp_response" + | "ftp_sup" + | "gb_sets" + | "gb_trees" + | "gen" + | "gen_event" + | "gen_fsm" + | "gen_sctp" + | "gen_server" + | "gen_statem" + | "gen_tcp" + | "gen_tcp_socket" + | "gen_udp" + | "gen_udp_socket" + | "gl" + | "global" + | "global_group" + | "global_search" + | "glu" + | "group" + | "group_history" + | "heart" + | "http_chunk" + | "http_request" + | "http_response" + | "http_transport" + | "http_uri" + | "http_util" + | "httpc" + | "httpc_cookie" + | "httpc_handler" + | "httpc_handler_sup" + | "httpc_manager" + | "httpc_profile_sup" + | "httpc_request" + | "httpc_response" + | "httpc_sup" + | "httpd" + | "httpd_acceptor" + | "httpd_acceptor_sup" + | "httpd_cgi" + | "httpd_conf" + | "httpd_connection_sup" + | "httpd_custom" + | "httpd_custom_api" + | "httpd_esi" + | "httpd_example" + | "httpd_file" + | "httpd_instance_sup" + | "httpd_log" + | "httpd_logger" + | "httpd_manager" + | "httpd_misc_sup" + | "httpd_request" + | "httpd_request_handler" + | "httpd_response" + | "httpd_script_env" + | "httpd_socket" + | "httpd_sup" + | "httpd_util" + | "i" + | "inet" + | "inet6_sctp" + | "inet6_tcp" + | "inet6_tcp_dist" + | "inet6_tls_dist" + | "inet6_udp" + | "inet_config" + | "inet_db" + | "inet_dns" + | "inet_epmd_dist" + | "inet_epmd_socket" + | "inet_gethost_native" + | "inet_hosts" + | "inet_parse" + | "inet_res" + | "inet_sctp" + | "inet_tcp" + | "inet_tcp_dist" + | "inet_tls_dist" + | "inet_udp" + | "inets" + | "inets_app" + | "inets_lib" + | "inets_service" + | "inets_sup" + | "inets_trace" + | "init" + | "instrument" + | "int" + | "io" + | "io_lib" + | "io_lib_format" + | "io_lib_fread" + | "io_lib_pretty" + | "kernel" + | "kernel_config" + | "kernel_refc" + | "lcnt" + | "leex" + | "lists" + | "local_tcp" + | "local_udp" + | "log_mf_h" + | "logger" + | "logger_backend" + | "logger_config" + | "logger_disk_log_h" + | "logger_filters" + | "logger_formatter" + | "logger_h_common" + | "logger_handler_watcher" + | "logger_olp" + | "logger_proxy" + | "logger_server" + | "logger_simple_h" + | "logger_std_h" + | "logger_sup" + | "make" + | "maps" + | "math" + | "megaco" + | "megaco_ber_encoder" + | "megaco_ber_media_gateway_control_v1" + | "megaco_ber_media_gateway_control_v2" + | "megaco_ber_media_gateway_control_v3" + | "megaco_binary_encoder" + | "megaco_binary_encoder_lib" + | "megaco_binary_name_resolver_v1" + | "megaco_binary_name_resolver_v2" + | "megaco_binary_name_resolver_v3" + | "megaco_binary_term_id" + | "megaco_binary_term_id_gen" + | "megaco_binary_transformer_v1" + | "megaco_binary_transformer_v2" + | "megaco_binary_transformer_v3" + | "megaco_compact_text_encoder" + | "megaco_compact_text_encoder_v1" + | "megaco_compact_text_encoder_v2" + | "megaco_compact_text_encoder_v3" + | "megaco_config" + | "megaco_config_misc" + | "megaco_digit_map" + | "megaco_edist_compress" + | "megaco_encoder" + | "megaco_erl_dist_encoder" + | "megaco_erl_dist_encoder_mc" + | "megaco_filter" + | "megaco_flex_scanner" + | "megaco_flex_scanner_handler" + | "megaco_messenger" + | "megaco_messenger_misc" + | "megaco_misc_sup" + | "megaco_monitor" + | "megaco_per_encoder" + | "megaco_per_media_gateway_control_v1" + | "megaco_per_media_gateway_control_v2" + | "megaco_per_media_gateway_control_v3" + | "megaco_pretty_text_encoder" + | "megaco_pretty_text_encoder_v1" + | "megaco_pretty_text_encoder_v2" + | "megaco_pretty_text_encoder_v3" + | "megaco_sdp" + | "megaco_stats" + | "megaco_sup" + | "megaco_tcp" + | "megaco_tcp_accept" + | "megaco_tcp_accept_sup" + | "megaco_tcp_connection" + | "megaco_tcp_connection_sup" + | "megaco_tcp_sup" + | "megaco_text_mini_decoder" + | "megaco_text_mini_parser" + | "megaco_text_parser_v1" + | "megaco_text_parser_v2" + | "megaco_text_parser_v3" + | "megaco_text_scanner" + | "megaco_timer" + | "megaco_trans_sender" + | "megaco_trans_sup" + | "megaco_transport" + | "megaco_udp" + | "megaco_udp_server" + | "megaco_udp_sup" + | "megaco_user" + | "megaco_user_default" + | "memsup" + | "merl" + | "merl_transform" + | "misc_supp" + | "mnesia" + | "mnesia_app" + | "mnesia_backend_type" + | "mnesia_backup" + | "mnesia_bup" + | "mnesia_checkpoint" + | "mnesia_checkpoint_sup" + | "mnesia_controller" + | "mnesia_dumper" + | "mnesia_event" + | "mnesia_ext_sup" + | "mnesia_frag" + | "mnesia_frag_hash" + | "mnesia_index" + | "mnesia_kernel_sup" + | "mnesia_late_loader" + | "mnesia_lib" + | "mnesia_loader" + | "mnesia_locker" + | "mnesia_log" + | "mnesia_monitor" + | "mnesia_recover" + | "mnesia_registry" + | "mnesia_rpc" + | "mnesia_schema" + | "mnesia_snmp_hook" + | "mnesia_sp" + | "mnesia_subscr" + | "mnesia_sup" + | "mnesia_text" + | "mnesia_tm" + | "mod_actions" + | "mod_alias" + | "mod_auth" + | "mod_auth_dets" + | "mod_auth_mnesia" + | "mod_auth_plain" + | "mod_auth_server" + | "mod_cgi" + | "mod_dir" + | "mod_disk_log" + | "mod_esi" + | "mod_get" + | "mod_head" + | "mod_log" + | "mod_range" + | "mod_responsecontrol" + | "mod_security" + | "mod_security_server" + | "mod_trace" + | "ms_transform" + | "msacc" + | "net" + | "net_adm" + | "net_kernel" + | "nteventlog" + | "observer" + | "observer_alloc_wx" + | "observer_app_wx" + | "observer_backend" + | "observer_html_lib" + | "observer_lib" + | "observer_perf_wx" + | "observer_port_wx" + | "observer_pro_wx" + | "observer_procinfo" + | "observer_sock_wx" + | "observer_sys_wx" + | "observer_trace_wx" + | "observer_traceoptions_wx" + | "observer_tv_table" + | "observer_tv_wx" + | "observer_wx" + | "orddict" + | "ordsets" + | "os" + | "os_mon" + | "os_mon_mib" + | "os_mon_sysinfo" + | "os_sup" + | "otp_internal" + | "peer" + | "persistent_term" + | "pg" + | "pg2" + | "pool" + | "prettypr" + | "prim_buffer" + | "prim_eval" + | "prim_file" + | "prim_inet" + | "prim_net" + | "prim_socket" + | "prim_tty" + | "prim_zip" + | "proc_lib" + | "proplists" + | "pubkey_cert" + | "pubkey_cert_records" + | "pubkey_crl" + | "pubkey_ocsp" + | "pubkey_os_cacerts" + | "pubkey_pbe" + | "pubkey_pem" + | "pubkey_policy_tree" + | "pubkey_ssh" + | "public_key" + | "qlc" + | "qlc_pt" + | "queue" + | "ram_file" + | "rand" + | "random" + | "raw_file_io" + | "raw_file_io_compressed" + | "raw_file_io_deflate" + | "raw_file_io_delayed" + | "raw_file_io_inflate" + | "raw_file_io_list" + | "rb" + | "rb_format_supp" + | "re" + | "rec_env" + | "release_handler" + | "release_handler_1" + | "reltool" + | "reltool_app_win" + | "reltool_fgraph" + | "reltool_fgraph_win" + | "reltool_mod_win" + | "reltool_server" + | "reltool_sys_win" + | "reltool_target" + | "reltool_utils" + | "rpc" + | "runtime_tools" + | "runtime_tools_sup" + | "sasl" + | "sasl_report" + | "sasl_report_file_h" + | "sasl_report_tty_h" + | "scheduler" + | "seq_trace" + | "sets" + | "shell" + | "shell_default" + | "shell_docs" + | "slave" + | "snmp" + | "snmp_app" + | "snmp_app_sup" + | "snmp_community_mib" + | "snmp_conf" + | "snmp_config" + | "snmp_framework_mib" + | "snmp_generic" + | "snmp_generic_mnesia" + | "snmp_index" + | "snmp_log" + | "snmp_mini_mib" + | "snmp_misc" + | "snmp_note_store" + | "snmp_notification_mib" + | "snmp_pdus" + | "snmp_shadow_table" + | "snmp_standard_mib" + | "snmp_target_mib" + | "snmp_user_based_sm_mib" + | "snmp_usm" + | "snmp_verbosity" + | "snmp_view_based_acm_mib" + | "snmpa" + | "snmpa_acm" + | "snmpa_agent" + | "snmpa_agent_sup" + | "snmpa_app" + | "snmpa_authentication_service" + | "snmpa_conf" + | "snmpa_discovery_handler" + | "snmpa_discovery_handler_default" + | "snmpa_error" + | "snmpa_error_io" + | "snmpa_error_logger" + | "snmpa_error_report" + | "snmpa_get" + | "snmpa_get_lib" + | "snmpa_get_mechanism" + | "snmpa_local_db" + | "snmpa_mib" + | "snmpa_mib_data" + | "snmpa_mib_data_tttn" + | "snmpa_mib_lib" + | "snmpa_mib_storage" + | "snmpa_mib_storage_dets" + | "snmpa_mib_storage_ets" + | "snmpa_mib_storage_mnesia" + | "snmpa_misc_sup" + | "snmpa_mpd" + | "snmpa_net_if" + | "snmpa_net_if_filter" + | "snmpa_network_interface" + | "snmpa_network_interface_filter" + | "snmpa_notification_delivery_info_receiver" + | "snmpa_notification_filter" + | "snmpa_set" + | "snmpa_set_lib" + | "snmpa_set_mechanism" + | "snmpa_supervisor" + | "snmpa_svbl" + | "snmpa_symbolic_store" + | "snmpa_target_cache" + | "snmpa_trap" + | "snmpa_usm" + | "snmpa_vacm" + | "snmpc" + | "snmpc_lib" + | "snmpc_mib_gram" + | "snmpc_mib_to_hrl" + | "snmpc_misc" + | "snmpc_tok" + | "snmpm" + | "snmpm_conf" + | "snmpm_config" + | "snmpm_misc_sup" + | "snmpm_mpd" + | "snmpm_net_if" + | "snmpm_net_if_filter" + | "snmpm_net_if_mt" + | "snmpm_network_interface" + | "snmpm_network_interface_filter" + | "snmpm_server" + | "snmpm_server_sup" + | "snmpm_supervisor" + | "snmpm_user" + | "snmpm_user_default" + | "snmpm_user_old" + | "snmpm_usm" + | "socket" + | "socket_registry" + | "sofs" + | "ssh" + | "ssh_acceptor" + | "ssh_acceptor_sup" + | "ssh_agent" + | "ssh_app" + | "ssh_auth" + | "ssh_bits" + | "ssh_channel" + | "ssh_channel_sup" + | "ssh_cli" + | "ssh_client_channel" + | "ssh_client_key_api" + | "ssh_connection" + | "ssh_connection_handler" + | "ssh_daemon_channel" + | "ssh_dbg" + | "ssh_file" + | "ssh_fsm_kexinit" + | "ssh_fsm_userauth_client" + | "ssh_fsm_userauth_server" + | "ssh_info" + | "ssh_io" + | "ssh_lib" + | "ssh_message" + | "ssh_no_io" + | "ssh_options" + | "ssh_server_channel" + | "ssh_server_key_api" + | "ssh_sftp" + | "ssh_sftpd" + | "ssh_sftpd_file" + | "ssh_sftpd_file_api" + | "ssh_shell" + | "ssh_subsystem_sup" + | "ssh_system_sup" + | "ssh_tcpip_forward_acceptor" + | "ssh_tcpip_forward_acceptor_sup" + | "ssh_tcpip_forward_client" + | "ssh_tcpip_forward_srv" + | "ssh_transport" + | "ssh_xfer" + | "ssl" + | "ssl_admin_sup" + | "ssl_alert" + | "ssl_app" + | "ssl_certificate" + | "ssl_cipher" + | "ssl_cipher_format" + | "ssl_client_session_cache_db" + | "ssl_config" + | "ssl_connection_sup" + | "ssl_crl" + | "ssl_crl_cache" + | "ssl_crl_cache_api" + | "ssl_crl_hash_dir" + | "ssl_dh_groups" + | "ssl_dist_admin_sup" + | "ssl_dist_connection_sup" + | "ssl_dist_sup" + | "ssl_gen_statem" + | "ssl_handshake" + | "ssl_listen_tracker_sup" + | "ssl_logger" + | "ssl_manager" + | "ssl_pem_cache" + | "ssl_pkix_db" + | "ssl_record" + | "ssl_server_session_cache" + | "ssl_server_session_cache_db" + | "ssl_server_session_cache_sup" + | "ssl_session" + | "ssl_session_cache_api" + | "ssl_srp_primes" + | "ssl_sup" + | "ssl_trace" + | "ssl_upgrade_server_session_cache_sup" + | "standard_error" + | "string" + | "supervisor" + | "supervisor_bridge" + | "sys" + | "sys_core_alias" + | "sys_core_bsm" + | "sys_core_fold" + | "sys_core_fold_lists" + | "sys_core_inline" + | "sys_core_prepare" + | "sys_messages" + | "sys_pre_attributes" + | "system_information" + | "systools" + | "systools_lib" + | "systools_make" + | "systools_rc" + | "systools_relup" + | "tags" + | "test_server" + | "test_server_ctrl" + | "test_server_gl" + | "test_server_io" + | "test_server_node" + | "test_server_sup" + | "tftp" + | "tftp_app" + | "tftp_binary" + | "tftp_engine" + | "tftp_file" + | "tftp_lib" + | "tftp_logger" + | "tftp_sup" + | "timer" + | "tls_bloom_filter" + | "tls_client_connection_1_3" + | "tls_client_ticket_store" + | "tls_connection" + | "tls_connection_sup" + | "tls_dist_server_sup" + | "tls_dist_sup" + | "tls_dtls_connection" + | "tls_dyn_connection_sup" + | "tls_gen_connection" + | "tls_gen_connection_1_3" + | "tls_handshake" + | "tls_handshake_1_3" + | "tls_record" + | "tls_record_1_3" + | "tls_sender" + | "tls_server_connection_1_3" + | "tls_server_session_ticket" + | "tls_server_session_ticket_sup" + | "tls_server_sup" + | "tls_socket" + | "tls_sup" + | "tls_v1" + | "ttb" + | "ttb_autostart" + | "ttb_et" + | "typer" + | "typer_core" + | "unicode" + | "unicode_util" + | "unix_telnet" + | "uri_string" + | "user_drv" + | "user_sup" + | "v3_core" + | "v3_kernel" + | "v3_kernel_pp" + | "win32reg" + | "wrap_log_reader" + | "wx" + | "wxAcceleratorEntry" + | "wxAcceleratorTable" + | "wxActivateEvent" + | "wxArtProvider" + | "wxAuiDockArt" + | "wxAuiManager" + | "wxAuiManagerEvent" + | "wxAuiNotebook" + | "wxAuiNotebookEvent" + | "wxAuiPaneInfo" + | "wxAuiSimpleTabArt" + | "wxAuiTabArt" + | "wxBitmap" + | "wxBitmapButton" + | "wxBitmapDataObject" + | "wxBookCtrlBase" + | "wxBookCtrlEvent" + | "wxBoxSizer" + | "wxBrush" + | "wxBufferedDC" + | "wxBufferedPaintDC" + | "wxButton" + | "wxCalendarCtrl" + | "wxCalendarDateAttr" + | "wxCalendarEvent" + | "wxCaret" + | "wxCheckBox" + | "wxCheckListBox" + | "wxChildFocusEvent" + | "wxChoice" + | "wxChoicebook" + | "wxClientDC" + | "wxClipboard" + | "wxClipboardTextEvent" + | "wxCloseEvent" + | "wxColourData" + | "wxColourDialog" + | "wxColourPickerCtrl" + | "wxColourPickerEvent" + | "wxComboBox" + | "wxCommandEvent" + | "wxContextMenuEvent" + | "wxControl" + | "wxControlWithItems" + | "wxCursor" + | "wxDC" + | "wxDCOverlay" + | "wxDataObject" + | "wxDateEvent" + | "wxDatePickerCtrl" + | "wxDialog" + | "wxDirDialog" + | "wxDirPickerCtrl" + | "wxDisplay" + | "wxDisplayChangedEvent" + | "wxDropFilesEvent" + | "wxEraseEvent" + | "wxEvent" + | "wxEvtHandler" + | "wxFileDataObject" + | "wxFileDialog" + | "wxFileDirPickerEvent" + | "wxFilePickerCtrl" + | "wxFindReplaceData" + | "wxFindReplaceDialog" + | "wxFlexGridSizer" + | "wxFocusEvent" + | "wxFont" + | "wxFontData" + | "wxFontDialog" + | "wxFontPickerCtrl" + | "wxFontPickerEvent" + | "wxFrame" + | "wxGBSizerItem" + | "wxGCDC" + | "wxGLCanvas" + | "wxGLContext" + | "wxGauge" + | "wxGenericDirCtrl" + | "wxGraphicsBrush" + | "wxGraphicsContext" + | "wxGraphicsFont" + | "wxGraphicsGradientStops" + | "wxGraphicsMatrix" + | "wxGraphicsObject" + | "wxGraphicsPath" + | "wxGraphicsPen" + | "wxGraphicsRenderer" + | "wxGrid" + | "wxGridBagSizer" + | "wxGridCellAttr" + | "wxGridCellBoolEditor" + | "wxGridCellBoolRenderer" + | "wxGridCellChoiceEditor" + | "wxGridCellEditor" + | "wxGridCellFloatEditor" + | "wxGridCellFloatRenderer" + | "wxGridCellNumberEditor" + | "wxGridCellNumberRenderer" + | "wxGridCellRenderer" + | "wxGridCellStringRenderer" + | "wxGridCellTextEditor" + | "wxGridEvent" + | "wxGridSizer" + | "wxHelpEvent" + | "wxHtmlEasyPrinting" + | "wxHtmlLinkEvent" + | "wxHtmlWindow" + | "wxIcon" + | "wxIconBundle" + | "wxIconizeEvent" + | "wxIdleEvent" + | "wxImage" + | "wxImageList" + | "wxInitDialogEvent" + | "wxJoystickEvent" + | "wxKeyEvent" + | "wxLayoutAlgorithm" + | "wxListBox" + | "wxListCtrl" + | "wxListEvent" + | "wxListItem" + | "wxListItemAttr" + | "wxListView" + | "wxListbook" + | "wxLocale" + | "wxLogNull" + | "wxMDIChildFrame" + | "wxMDIClientWindow" + | "wxMDIParentFrame" + | "wxMask" + | "wxMaximizeEvent" + | "wxMemoryDC" + | "wxMenu" + | "wxMenuBar" + | "wxMenuEvent" + | "wxMenuItem" + | "wxMessageDialog" + | "wxMiniFrame" + | "wxMirrorDC" + | "wxMouseCaptureChangedEvent" + | "wxMouseCaptureLostEvent" + | "wxMouseEvent" + | "wxMoveEvent" + | "wxMultiChoiceDialog" + | "wxNavigationKeyEvent" + | "wxNotebook" + | "wxNotificationMessage" + | "wxNotifyEvent" + | "wxOverlay" + | "wxPageSetupDialog" + | "wxPageSetupDialogData" + | "wxPaintDC" + | "wxPaintEvent" + | "wxPalette" + | "wxPaletteChangedEvent" + | "wxPanel" + | "wxPasswordEntryDialog" + | "wxPen" + | "wxPickerBase" + | "wxPopupTransientWindow" + | "wxPopupWindow" + | "wxPostScriptDC" + | "wxPreviewCanvas" + | "wxPreviewControlBar" + | "wxPreviewFrame" + | "wxPrintData" + | "wxPrintDialog" + | "wxPrintDialogData" + | "wxPrintPreview" + | "wxPrinter" + | "wxPrintout" + | "wxProgressDialog" + | "wxQueryNewPaletteEvent" + | "wxRadioBox" + | "wxRadioButton" + | "wxRegion" + | "wxSashEvent" + | "wxSashLayoutWindow" + | "wxSashWindow" + | "wxScreenDC" + | "wxScrollBar" + | "wxScrollEvent" + | "wxScrollWinEvent" + | "wxScrolledWindow" + | "wxSetCursorEvent" + | "wxShowEvent" + | "wxSingleChoiceDialog" + | "wxSizeEvent" + | "wxSizer" + | "wxSizerFlags" + | "wxSizerItem" + | "wxSlider" + | "wxSpinButton" + | "wxSpinCtrl" + | "wxSpinEvent" + | "wxSplashScreen" + | "wxSplitterEvent" + | "wxSplitterWindow" + | "wxStaticBitmap" + | "wxStaticBox" + | "wxStaticBoxSizer" + | "wxStaticLine" + | "wxStaticText" + | "wxStatusBar" + | "wxStdDialogButtonSizer" + | "wxStyledTextCtrl" + | "wxStyledTextEvent" + | "wxSysColourChangedEvent" + | "wxSystemOptions" + | "wxSystemSettings" + | "wxTaskBarIcon" + | "wxTaskBarIconEvent" + | "wxTextAttr" + | "wxTextCtrl" + | "wxTextDataObject" + | "wxTextEntryDialog" + | "wxToggleButton" + | "wxToolBar" + | "wxToolTip" + | "wxToolbook" + | "wxTopLevelWindow" + | "wxTreeCtrl" + | "wxTreeEvent" + | "wxTreebook" + | "wxUpdateUIEvent" + | "wxWebView" + | "wxWebViewEvent" + | "wxWindow" + | "wxWindowCreateEvent" + | "wxWindowDC" + | "wxWindowDestroyEvent" + | "wxXmlResource" + | "wx_misc" + | "wx_object" + | "wxe_master" + | "wxe_server" + | "wxe_util" + | "xmerl" + | "xmerl_b64Bin" + | "xmerl_b64Bin_scan" + | "xmerl_eventp" + | "xmerl_html" + | "xmerl_lib" + | "xmerl_otpsgml" + | "xmerl_regexp" + | "xmerl_sax_old_dom" + | "xmerl_sax_parser" + | "xmerl_sax_parser_latin1" + | "xmerl_sax_parser_list" + | "xmerl_sax_parser_utf16be" + | "xmerl_sax_parser_utf16le" + | "xmerl_sax_parser_utf8" + | "xmerl_sax_simple_dom" + | "xmerl_scan" + | "xmerl_sgml" + | "xmerl_simple" + | "xmerl_text" + | "xmerl_ucs" + | "xmerl_uri" + | "xmerl_validate" + | "xmerl_xlate" + | "xmerl_xml" + | "xmerl_xpath" + | "xmerl_xpath_lib" + | "xmerl_xpath_parse" + | "xmerl_xpath_pred" + | "xmerl_xpath_scan" + | "xmerl_xs" + | "xmerl_xsd" + | "xmerl_xsd_type" + | "xref" + | "xref_base" + | "xref_compiler" + | "xref_parser" + | "xref_reader" + | "xref_scanner" + | "xref_utils" + | "yecc" + | "yeccparser" + | "yeccscan" + | "zip" + | "zlib" => (), + _ => return Ok(()), + } + + Err(Error::GleamModuleWouldOverwriteStandardErlangModule { + name: name.into(), + path: path.to_owned(), + }) + } } fn convert_deps_tree_error(e: dep_tree::Error) -> Error { From 1d2d7febcec2e3beff1703cee1c3a08f9b70d1d9 Mon Sep 17 00:00:00 2001 From: Louis Pilfold Date: Mon, 27 May 2024 23:55:46 +0100 Subject: [PATCH 2/8] Simplify logic by using module name --- compiler-core/src/build/package_loader.rs | 2602 ++++++++++----------- 1 file changed, 1291 insertions(+), 1311 deletions(-) diff --git a/compiler-core/src/build/package_loader.rs b/compiler-core/src/build/package_loader.rs index 05ce20c4d..eea0a66cb 100644 --- a/compiler-core/src/build/package_loader.rs +++ b/compiler-core/src/build/package_loader.rs @@ -216,17 +216,6 @@ where continue; } - // If we are compiling for Erlang then modules all live in a single - // namespace. If we were to name a module the same as a module that - // is included in the standard Erlang distribution then this new - // Gleam module would overwrite the existing Erlang one, likely - // resulting in cryptic errors. - // This would most commonly happen for modules like "user" and - // "code". Emit an error so this never happens. - if self.target.is_erlang() { - self.ensure_gleam_module_does_not_overwrite_standard_erlang_module(&path)?; - } - let input = loader.load(path)?; inputs.insert(input)?; } @@ -247,6 +236,19 @@ where } } + // If we are compiling for Erlang then modules all live in a single + // namespace. If we were to name a module the same as a module that + // is included in the standard Erlang distribution then this new + // Gleam module would overwrite the existing Erlang one, likely + // resulting in cryptic errors. + // This would most commonly happen for modules like "user" and + // "code". Emit an error so this never happens. + if self.target.is_erlang() { + for input in inputs.collection.values() { + ensure_gleam_module_does_not_overwrite_standard_erlang_module(&input)?; + } + } + Ok(inputs.collection) } @@ -262,1309 +264,1287 @@ where mtime, ) } +} - fn ensure_gleam_module_does_not_overwrite_standard_erlang_module( - &self, - path: &Utf8Path, - ) -> Result<()> { - let path = path.strip_prefix(self.root).unwrap_or(path); - - let mut segments = path.iter(); - // Remove the first segement, which will be either `src/` or `test/` - let _ = segments.next(); - - let name = segments - .next() - .expect("There must always be a file name for a Gleam module"); - - // If there are remaining segments it means that this is a nested module and - // such cannot collide with a built-in Erlang module. - // - // For example, it could be the module `src/user/code.gleam` but could not - // be the module `src/code.gleam`. - if segments.next().is_some() { - return Ok(()); - } - - // Remove the .gleam extension, as this isn't part of the module name. - let name = name.trim_end_matches(".gleam"); +fn ensure_gleam_module_does_not_overwrite_standard_erlang_module(input: &Input) -> Result<()> { + // We only need to check uncached modules as it's not possible for these + // to have compiled successfully. + let Input::New(input) = input else { + return Ok(()); + }; - // If we got get here then it's not nested. Let's check if the name - // collides or not. - // - // These names were got with this Erlang - // - // ```erl - // file:write_file("names.txt", lists:join("\n",lists:map(fun(T) -> erlang:element(1, T) end, code:all_available()))). - // ``` - // - match name { - "alarm_handler" - | "application" - | "application_controller" - | "application_master" - | "application_starter" - | "appmon_info" - | "argparse" - | "array" - | "asn1_db" - | "asn1ct" - | "asn1ct_check" - | "asn1ct_constructed_ber_bin_v2" - | "asn1ct_constructed_per" - | "asn1ct_eval_ext" - | "asn1ct_func" - | "asn1ct_gen" - | "asn1ct_gen_ber_bin_v2" - | "asn1ct_gen_check" - | "asn1ct_gen_jer" - | "asn1ct_gen_per" - | "asn1ct_imm" - | "asn1ct_name" - | "asn1ct_parser2" - | "asn1ct_pretty_format" - | "asn1ct_rtt" - | "asn1ct_table" - | "asn1ct_tok" - | "asn1ct_value" - | "asn1rt_nif" - | "atomics" - | "auth" - | "base64" - | "beam_a" - | "beam_asm" - | "beam_block" - | "beam_bounds" - | "beam_call_types" - | "beam_clean" - | "beam_dict" - | "beam_digraph" - | "beam_disasm" - | "beam_flatten" - | "beam_jump" - | "beam_kernel_to_ssa" - | "beam_lib" - | "beam_listing" - | "beam_opcodes" - | "beam_ssa" - | "beam_ssa_alias" - | "beam_ssa_bc_size" - | "beam_ssa_bool" - | "beam_ssa_bsm" - | "beam_ssa_check" - | "beam_ssa_codegen" - | "beam_ssa_dead" - | "beam_ssa_lint" - | "beam_ssa_opt" - | "beam_ssa_pp" - | "beam_ssa_pre_codegen" - | "beam_ssa_private_append" - | "beam_ssa_recv" - | "beam_ssa_share" - | "beam_ssa_throw" - | "beam_ssa_type" - | "beam_trim" - | "beam_types" - | "beam_utils" - | "beam_validator" - | "beam_z" - | "binary" - | "c" - | "calendar" - | "cdv_atom_cb" - | "cdv_bin_cb" - | "cdv_detail_wx" - | "cdv_dist_cb" - | "cdv_ets_cb" - | "cdv_fun_cb" - | "cdv_gen_cb" - | "cdv_html_wx" - | "cdv_info_wx" - | "cdv_int_tab_cb" - | "cdv_mem_cb" - | "cdv_mod_cb" - | "cdv_multi_wx" - | "cdv_persistent_cb" - | "cdv_port_cb" - | "cdv_proc_cb" - | "cdv_sched_cb" - | "cdv_table_wx" - | "cdv_term_cb" - | "cdv_timer_cb" - | "cdv_virtual_list_wx" - | "cdv_wx" - | "cerl" - | "cerl_clauses" - | "cerl_inline" - | "cerl_prettypr" - | "cerl_trees" - | "code" - | "code_server" - | "compile" - | "core_lib" - | "core_lint" - | "core_parse" - | "core_pp" - | "core_scan" - | "counters" - | "cover" - | "cprof" - | "cpu_sup" - | "crashdump_viewer" - | "crypto" - | "crypto_ec_curves" - | "ct" - | "ct_config" - | "ct_config_plain" - | "ct_config_xml" - | "ct_conn_log_h" - | "ct_cover" - | "ct_default_gl" - | "ct_event" - | "ct_framework" - | "ct_ftp" - | "ct_gen_conn" - | "ct_groups" - | "ct_hooks" - | "ct_hooks_lock" - | "ct_logs" - | "ct_make" - | "ct_master" - | "ct_master_event" - | "ct_master_logs" - | "ct_master_status" - | "ct_netconfc" - | "ct_property_test" - | "ct_release_test" - | "ct_repeat" - | "ct_rpc" - | "ct_run" - | "ct_slave" - | "ct_snmp" - | "ct_ssh" - | "ct_suite" - | "ct_telnet" - | "ct_telnet_client" - | "ct_testspec" - | "ct_util" - | "cth_conn_log" - | "cth_log_redirect" - | "cth_surefire" - | "dbg" - | "dbg_debugged" - | "dbg_icmd" - | "dbg_idb" - | "dbg_ieval" - | "dbg_iload" - | "dbg_iserver" - | "dbg_istk" - | "dbg_wx_break" - | "dbg_wx_break_win" - | "dbg_wx_code" - | "dbg_wx_filedialog_win" - | "dbg_wx_interpret" - | "dbg_wx_mon" - | "dbg_wx_mon_win" - | "dbg_wx_settings" - | "dbg_wx_src_view" - | "dbg_wx_trace" - | "dbg_wx_trace_win" - | "dbg_wx_view" - | "dbg_wx_win" - | "dbg_wx_winman" - | "debugger" - | "dets" - | "dets_server" - | "dets_sup" - | "dets_utils" - | "dets_v9" - | "dialyzer" - | "dialyzer_analysis_callgraph" - | "dialyzer_behaviours" - | "dialyzer_callgraph" - | "dialyzer_cl" - | "dialyzer_cl_parse" - | "dialyzer_clean_core" - | "dialyzer_codeserver" - | "dialyzer_contracts" - | "dialyzer_coordinator" - | "dialyzer_cplt" - | "dialyzer_dataflow" - | "dialyzer_dep" - | "dialyzer_dot" - | "dialyzer_explanation" - | "dialyzer_gui_wx" - | "dialyzer_incremental" - | "dialyzer_iplt" - | "dialyzer_options" - | "dialyzer_plt" - | "dialyzer_succ_typings" - | "dialyzer_timing" - | "dialyzer_typegraph" - | "dialyzer_typesig" - | "dialyzer_utils" - | "dialyzer_worker" - | "diameter" - | "diameter_app" - | "diameter_callback" - | "diameter_capx" - | "diameter_codec" - | "diameter_codegen" - | "diameter_config" - | "diameter_config_sup" - | "diameter_dbg" - | "diameter_dict_parser" - | "diameter_dict_scanner" - | "diameter_dict_util" - | "diameter_dist" - | "diameter_etcp" - | "diameter_etcp_sup" - | "diameter_exprecs" - | "diameter_gen" - | "diameter_gen_acct_rfc6733" - | "diameter_gen_base_accounting" - | "diameter_gen_base_rfc3588" - | "diameter_gen_base_rfc6733" - | "diameter_gen_doic_rfc7683" - | "diameter_gen_relay" - | "diameter_info" - | "diameter_lib" - | "diameter_make" - | "diameter_misc_sup" - | "diameter_peer" - | "diameter_peer_fsm" - | "diameter_peer_fsm_sup" - | "diameter_reg" - | "diameter_sctp" - | "diameter_sctp_sup" - | "diameter_service" - | "diameter_service_sup" - | "diameter_session" - | "diameter_stats" - | "diameter_sup" - | "diameter_sync" - | "diameter_tcp" - | "diameter_tcp_sup" - | "diameter_traffic" - | "diameter_transport" - | "diameter_transport_sup" - | "diameter_types" - | "diameter_watchdog" - | "diameter_watchdog_sup" - | "dict" - | "digraph" - | "digraph_utils" - | "disk_log" - | "disk_log_1" - | "disk_log_server" - | "disk_log_sup" - | "disksup" - | "dist_ac" - | "dist_util" - | "docgen_edoc_xml_cb" - | "docgen_otp_specs" - | "docgen_xmerl_xml_cb" - | "docgen_xml_to_chunk" - | "dtls_connection" - | "dtls_connection_sup" - | "dtls_gen_connection" - | "dtls_handshake" - | "dtls_listener_sup" - | "dtls_packet_demux" - | "dtls_record" - | "dtls_server_session_cache_sup" - | "dtls_server_sup" - | "dtls_socket" - | "dtls_sup" - | "dtls_v1" - | "dyntrace" - | "edlin" - | "edlin_context" - | "edlin_expand" - | "edlin_key" - | "edlin_type_suggestion" - | "edoc" - | "edoc_cli" - | "edoc_data" - | "edoc_doclet" - | "edoc_doclet_chunks" - | "edoc_extract" - | "edoc_layout" - | "edoc_layout_chunks" - | "edoc_lib" - | "edoc_macros" - | "edoc_parser" - | "edoc_refs" - | "edoc_report" - | "edoc_run" - | "edoc_scanner" - | "edoc_specs" - | "edoc_tags" - | "edoc_types" - | "edoc_wiki" - | "eldap" - | "epp" - | "epp_dodger" - | "eprof" - | "erl2html2" - | "erl_abstract_code" - | "erl_anno" - | "erl_bif_types" - | "erl_bifs" - | "erl_bits" - | "erl_boot_server" - | "erl_comment_scan" - | "erl_compile" - | "erl_compile_server" - | "erl_ddll" - | "erl_distribution" - | "erl_epmd" - | "erl_error" - | "erl_erts_errors" - | "erl_eval" - | "erl_expand_records" - | "erl_features" - | "erl_init" - | "erl_internal" - | "erl_kernel_errors" - | "erl_lint" - | "erl_parse" - | "erl_posix_msg" - | "erl_pp" - | "erl_prettypr" - | "erl_prim_loader" - | "erl_recomment" - | "erl_reply" - | "erl_scan" - | "erl_signal_handler" - | "erl_stdlib_errors" - | "erl_syntax" - | "erl_syntax_lib" - | "erl_tar" - | "erl_tracer" - | "erl_types" - | "erlang" - | "erlsrv" - | "erpc" - | "error_handler" - | "error_logger" - | "error_logger_file_h" - | "error_logger_tty_h" - | "erts_alloc_config" - | "erts_code_purger" - | "erts_debug" - | "erts_dirty_process_signal_handler" - | "erts_internal" - | "erts_literal_area_collector" - | "escript" - | "et" - | "et_collector" - | "et_selector" - | "et_viewer" - | "et_wx_contents_viewer" - | "et_wx_viewer" - | "etop" - | "etop_tr" - | "etop_txt" - | "ets" - | "eunit" - | "eunit_autoexport" - | "eunit_data" - | "eunit_lib" - | "eunit_listener" - | "eunit_proc" - | "eunit_serial" - | "eunit_server" - | "eunit_striptests" - | "eunit_surefire" - | "eunit_test" - | "eunit_tests" - | "eunit_tty" - | "eval_bits" - | "file" - | "file_io_server" - | "file_server" - | "file_sorter" - | "filelib" - | "filename" - | "format_lib_supp" - | "fprof" - | "ftp" - | "ftp_app" - | "ftp_internal" - | "ftp_progress" - | "ftp_response" - | "ftp_sup" - | "gb_sets" - | "gb_trees" - | "gen" - | "gen_event" - | "gen_fsm" - | "gen_sctp" - | "gen_server" - | "gen_statem" - | "gen_tcp" - | "gen_tcp_socket" - | "gen_udp" - | "gen_udp_socket" - | "gl" - | "global" - | "global_group" - | "global_search" - | "glu" - | "group" - | "group_history" - | "heart" - | "http_chunk" - | "http_request" - | "http_response" - | "http_transport" - | "http_uri" - | "http_util" - | "httpc" - | "httpc_cookie" - | "httpc_handler" - | "httpc_handler_sup" - | "httpc_manager" - | "httpc_profile_sup" - | "httpc_request" - | "httpc_response" - | "httpc_sup" - | "httpd" - | "httpd_acceptor" - | "httpd_acceptor_sup" - | "httpd_cgi" - | "httpd_conf" - | "httpd_connection_sup" - | "httpd_custom" - | "httpd_custom_api" - | "httpd_esi" - | "httpd_example" - | "httpd_file" - | "httpd_instance_sup" - | "httpd_log" - | "httpd_logger" - | "httpd_manager" - | "httpd_misc_sup" - | "httpd_request" - | "httpd_request_handler" - | "httpd_response" - | "httpd_script_env" - | "httpd_socket" - | "httpd_sup" - | "httpd_util" - | "i" - | "inet" - | "inet6_sctp" - | "inet6_tcp" - | "inet6_tcp_dist" - | "inet6_tls_dist" - | "inet6_udp" - | "inet_config" - | "inet_db" - | "inet_dns" - | "inet_epmd_dist" - | "inet_epmd_socket" - | "inet_gethost_native" - | "inet_hosts" - | "inet_parse" - | "inet_res" - | "inet_sctp" - | "inet_tcp" - | "inet_tcp_dist" - | "inet_tls_dist" - | "inet_udp" - | "inets" - | "inets_app" - | "inets_lib" - | "inets_service" - | "inets_sup" - | "inets_trace" - | "init" - | "instrument" - | "int" - | "io" - | "io_lib" - | "io_lib_format" - | "io_lib_fread" - | "io_lib_pretty" - | "kernel" - | "kernel_config" - | "kernel_refc" - | "lcnt" - | "leex" - | "lists" - | "local_tcp" - | "local_udp" - | "log_mf_h" - | "logger" - | "logger_backend" - | "logger_config" - | "logger_disk_log_h" - | "logger_filters" - | "logger_formatter" - | "logger_h_common" - | "logger_handler_watcher" - | "logger_olp" - | "logger_proxy" - | "logger_server" - | "logger_simple_h" - | "logger_std_h" - | "logger_sup" - | "make" - | "maps" - | "math" - | "megaco" - | "megaco_ber_encoder" - | "megaco_ber_media_gateway_control_v1" - | "megaco_ber_media_gateway_control_v2" - | "megaco_ber_media_gateway_control_v3" - | "megaco_binary_encoder" - | "megaco_binary_encoder_lib" - | "megaco_binary_name_resolver_v1" - | "megaco_binary_name_resolver_v2" - | "megaco_binary_name_resolver_v3" - | "megaco_binary_term_id" - | "megaco_binary_term_id_gen" - | "megaco_binary_transformer_v1" - | "megaco_binary_transformer_v2" - | "megaco_binary_transformer_v3" - | "megaco_compact_text_encoder" - | "megaco_compact_text_encoder_v1" - | "megaco_compact_text_encoder_v2" - | "megaco_compact_text_encoder_v3" - | "megaco_config" - | "megaco_config_misc" - | "megaco_digit_map" - | "megaco_edist_compress" - | "megaco_encoder" - | "megaco_erl_dist_encoder" - | "megaco_erl_dist_encoder_mc" - | "megaco_filter" - | "megaco_flex_scanner" - | "megaco_flex_scanner_handler" - | "megaco_messenger" - | "megaco_messenger_misc" - | "megaco_misc_sup" - | "megaco_monitor" - | "megaco_per_encoder" - | "megaco_per_media_gateway_control_v1" - | "megaco_per_media_gateway_control_v2" - | "megaco_per_media_gateway_control_v3" - | "megaco_pretty_text_encoder" - | "megaco_pretty_text_encoder_v1" - | "megaco_pretty_text_encoder_v2" - | "megaco_pretty_text_encoder_v3" - | "megaco_sdp" - | "megaco_stats" - | "megaco_sup" - | "megaco_tcp" - | "megaco_tcp_accept" - | "megaco_tcp_accept_sup" - | "megaco_tcp_connection" - | "megaco_tcp_connection_sup" - | "megaco_tcp_sup" - | "megaco_text_mini_decoder" - | "megaco_text_mini_parser" - | "megaco_text_parser_v1" - | "megaco_text_parser_v2" - | "megaco_text_parser_v3" - | "megaco_text_scanner" - | "megaco_timer" - | "megaco_trans_sender" - | "megaco_trans_sup" - | "megaco_transport" - | "megaco_udp" - | "megaco_udp_server" - | "megaco_udp_sup" - | "megaco_user" - | "megaco_user_default" - | "memsup" - | "merl" - | "merl_transform" - | "misc_supp" - | "mnesia" - | "mnesia_app" - | "mnesia_backend_type" - | "mnesia_backup" - | "mnesia_bup" - | "mnesia_checkpoint" - | "mnesia_checkpoint_sup" - | "mnesia_controller" - | "mnesia_dumper" - | "mnesia_event" - | "mnesia_ext_sup" - | "mnesia_frag" - | "mnesia_frag_hash" - | "mnesia_index" - | "mnesia_kernel_sup" - | "mnesia_late_loader" - | "mnesia_lib" - | "mnesia_loader" - | "mnesia_locker" - | "mnesia_log" - | "mnesia_monitor" - | "mnesia_recover" - | "mnesia_registry" - | "mnesia_rpc" - | "mnesia_schema" - | "mnesia_snmp_hook" - | "mnesia_sp" - | "mnesia_subscr" - | "mnesia_sup" - | "mnesia_text" - | "mnesia_tm" - | "mod_actions" - | "mod_alias" - | "mod_auth" - | "mod_auth_dets" - | "mod_auth_mnesia" - | "mod_auth_plain" - | "mod_auth_server" - | "mod_cgi" - | "mod_dir" - | "mod_disk_log" - | "mod_esi" - | "mod_get" - | "mod_head" - | "mod_log" - | "mod_range" - | "mod_responsecontrol" - | "mod_security" - | "mod_security_server" - | "mod_trace" - | "ms_transform" - | "msacc" - | "net" - | "net_adm" - | "net_kernel" - | "nteventlog" - | "observer" - | "observer_alloc_wx" - | "observer_app_wx" - | "observer_backend" - | "observer_html_lib" - | "observer_lib" - | "observer_perf_wx" - | "observer_port_wx" - | "observer_pro_wx" - | "observer_procinfo" - | "observer_sock_wx" - | "observer_sys_wx" - | "observer_trace_wx" - | "observer_traceoptions_wx" - | "observer_tv_table" - | "observer_tv_wx" - | "observer_wx" - | "orddict" - | "ordsets" - | "os" - | "os_mon" - | "os_mon_mib" - | "os_mon_sysinfo" - | "os_sup" - | "otp_internal" - | "peer" - | "persistent_term" - | "pg" - | "pg2" - | "pool" - | "prettypr" - | "prim_buffer" - | "prim_eval" - | "prim_file" - | "prim_inet" - | "prim_net" - | "prim_socket" - | "prim_tty" - | "prim_zip" - | "proc_lib" - | "proplists" - | "pubkey_cert" - | "pubkey_cert_records" - | "pubkey_crl" - | "pubkey_ocsp" - | "pubkey_os_cacerts" - | "pubkey_pbe" - | "pubkey_pem" - | "pubkey_policy_tree" - | "pubkey_ssh" - | "public_key" - | "qlc" - | "qlc_pt" - | "queue" - | "ram_file" - | "rand" - | "random" - | "raw_file_io" - | "raw_file_io_compressed" - | "raw_file_io_deflate" - | "raw_file_io_delayed" - | "raw_file_io_inflate" - | "raw_file_io_list" - | "rb" - | "rb_format_supp" - | "re" - | "rec_env" - | "release_handler" - | "release_handler_1" - | "reltool" - | "reltool_app_win" - | "reltool_fgraph" - | "reltool_fgraph_win" - | "reltool_mod_win" - | "reltool_server" - | "reltool_sys_win" - | "reltool_target" - | "reltool_utils" - | "rpc" - | "runtime_tools" - | "runtime_tools_sup" - | "sasl" - | "sasl_report" - | "sasl_report_file_h" - | "sasl_report_tty_h" - | "scheduler" - | "seq_trace" - | "sets" - | "shell" - | "shell_default" - | "shell_docs" - | "slave" - | "snmp" - | "snmp_app" - | "snmp_app_sup" - | "snmp_community_mib" - | "snmp_conf" - | "snmp_config" - | "snmp_framework_mib" - | "snmp_generic" - | "snmp_generic_mnesia" - | "snmp_index" - | "snmp_log" - | "snmp_mini_mib" - | "snmp_misc" - | "snmp_note_store" - | "snmp_notification_mib" - | "snmp_pdus" - | "snmp_shadow_table" - | "snmp_standard_mib" - | "snmp_target_mib" - | "snmp_user_based_sm_mib" - | "snmp_usm" - | "snmp_verbosity" - | "snmp_view_based_acm_mib" - | "snmpa" - | "snmpa_acm" - | "snmpa_agent" - | "snmpa_agent_sup" - | "snmpa_app" - | "snmpa_authentication_service" - | "snmpa_conf" - | "snmpa_discovery_handler" - | "snmpa_discovery_handler_default" - | "snmpa_error" - | "snmpa_error_io" - | "snmpa_error_logger" - | "snmpa_error_report" - | "snmpa_get" - | "snmpa_get_lib" - | "snmpa_get_mechanism" - | "snmpa_local_db" - | "snmpa_mib" - | "snmpa_mib_data" - | "snmpa_mib_data_tttn" - | "snmpa_mib_lib" - | "snmpa_mib_storage" - | "snmpa_mib_storage_dets" - | "snmpa_mib_storage_ets" - | "snmpa_mib_storage_mnesia" - | "snmpa_misc_sup" - | "snmpa_mpd" - | "snmpa_net_if" - | "snmpa_net_if_filter" - | "snmpa_network_interface" - | "snmpa_network_interface_filter" - | "snmpa_notification_delivery_info_receiver" - | "snmpa_notification_filter" - | "snmpa_set" - | "snmpa_set_lib" - | "snmpa_set_mechanism" - | "snmpa_supervisor" - | "snmpa_svbl" - | "snmpa_symbolic_store" - | "snmpa_target_cache" - | "snmpa_trap" - | "snmpa_usm" - | "snmpa_vacm" - | "snmpc" - | "snmpc_lib" - | "snmpc_mib_gram" - | "snmpc_mib_to_hrl" - | "snmpc_misc" - | "snmpc_tok" - | "snmpm" - | "snmpm_conf" - | "snmpm_config" - | "snmpm_misc_sup" - | "snmpm_mpd" - | "snmpm_net_if" - | "snmpm_net_if_filter" - | "snmpm_net_if_mt" - | "snmpm_network_interface" - | "snmpm_network_interface_filter" - | "snmpm_server" - | "snmpm_server_sup" - | "snmpm_supervisor" - | "snmpm_user" - | "snmpm_user_default" - | "snmpm_user_old" - | "snmpm_usm" - | "socket" - | "socket_registry" - | "sofs" - | "ssh" - | "ssh_acceptor" - | "ssh_acceptor_sup" - | "ssh_agent" - | "ssh_app" - | "ssh_auth" - | "ssh_bits" - | "ssh_channel" - | "ssh_channel_sup" - | "ssh_cli" - | "ssh_client_channel" - | "ssh_client_key_api" - | "ssh_connection" - | "ssh_connection_handler" - | "ssh_daemon_channel" - | "ssh_dbg" - | "ssh_file" - | "ssh_fsm_kexinit" - | "ssh_fsm_userauth_client" - | "ssh_fsm_userauth_server" - | "ssh_info" - | "ssh_io" - | "ssh_lib" - | "ssh_message" - | "ssh_no_io" - | "ssh_options" - | "ssh_server_channel" - | "ssh_server_key_api" - | "ssh_sftp" - | "ssh_sftpd" - | "ssh_sftpd_file" - | "ssh_sftpd_file_api" - | "ssh_shell" - | "ssh_subsystem_sup" - | "ssh_system_sup" - | "ssh_tcpip_forward_acceptor" - | "ssh_tcpip_forward_acceptor_sup" - | "ssh_tcpip_forward_client" - | "ssh_tcpip_forward_srv" - | "ssh_transport" - | "ssh_xfer" - | "ssl" - | "ssl_admin_sup" - | "ssl_alert" - | "ssl_app" - | "ssl_certificate" - | "ssl_cipher" - | "ssl_cipher_format" - | "ssl_client_session_cache_db" - | "ssl_config" - | "ssl_connection_sup" - | "ssl_crl" - | "ssl_crl_cache" - | "ssl_crl_cache_api" - | "ssl_crl_hash_dir" - | "ssl_dh_groups" - | "ssl_dist_admin_sup" - | "ssl_dist_connection_sup" - | "ssl_dist_sup" - | "ssl_gen_statem" - | "ssl_handshake" - | "ssl_listen_tracker_sup" - | "ssl_logger" - | "ssl_manager" - | "ssl_pem_cache" - | "ssl_pkix_db" - | "ssl_record" - | "ssl_server_session_cache" - | "ssl_server_session_cache_db" - | "ssl_server_session_cache_sup" - | "ssl_session" - | "ssl_session_cache_api" - | "ssl_srp_primes" - | "ssl_sup" - | "ssl_trace" - | "ssl_upgrade_server_session_cache_sup" - | "standard_error" - | "string" - | "supervisor" - | "supervisor_bridge" - | "sys" - | "sys_core_alias" - | "sys_core_bsm" - | "sys_core_fold" - | "sys_core_fold_lists" - | "sys_core_inline" - | "sys_core_prepare" - | "sys_messages" - | "sys_pre_attributes" - | "system_information" - | "systools" - | "systools_lib" - | "systools_make" - | "systools_rc" - | "systools_relup" - | "tags" - | "test_server" - | "test_server_ctrl" - | "test_server_gl" - | "test_server_io" - | "test_server_node" - | "test_server_sup" - | "tftp" - | "tftp_app" - | "tftp_binary" - | "tftp_engine" - | "tftp_file" - | "tftp_lib" - | "tftp_logger" - | "tftp_sup" - | "timer" - | "tls_bloom_filter" - | "tls_client_connection_1_3" - | "tls_client_ticket_store" - | "tls_connection" - | "tls_connection_sup" - | "tls_dist_server_sup" - | "tls_dist_sup" - | "tls_dtls_connection" - | "tls_dyn_connection_sup" - | "tls_gen_connection" - | "tls_gen_connection_1_3" - | "tls_handshake" - | "tls_handshake_1_3" - | "tls_record" - | "tls_record_1_3" - | "tls_sender" - | "tls_server_connection_1_3" - | "tls_server_session_ticket" - | "tls_server_session_ticket_sup" - | "tls_server_sup" - | "tls_socket" - | "tls_sup" - | "tls_v1" - | "ttb" - | "ttb_autostart" - | "ttb_et" - | "typer" - | "typer_core" - | "unicode" - | "unicode_util" - | "unix_telnet" - | "uri_string" - | "user_drv" - | "user_sup" - | "v3_core" - | "v3_kernel" - | "v3_kernel_pp" - | "win32reg" - | "wrap_log_reader" - | "wx" - | "wxAcceleratorEntry" - | "wxAcceleratorTable" - | "wxActivateEvent" - | "wxArtProvider" - | "wxAuiDockArt" - | "wxAuiManager" - | "wxAuiManagerEvent" - | "wxAuiNotebook" - | "wxAuiNotebookEvent" - | "wxAuiPaneInfo" - | "wxAuiSimpleTabArt" - | "wxAuiTabArt" - | "wxBitmap" - | "wxBitmapButton" - | "wxBitmapDataObject" - | "wxBookCtrlBase" - | "wxBookCtrlEvent" - | "wxBoxSizer" - | "wxBrush" - | "wxBufferedDC" - | "wxBufferedPaintDC" - | "wxButton" - | "wxCalendarCtrl" - | "wxCalendarDateAttr" - | "wxCalendarEvent" - | "wxCaret" - | "wxCheckBox" - | "wxCheckListBox" - | "wxChildFocusEvent" - | "wxChoice" - | "wxChoicebook" - | "wxClientDC" - | "wxClipboard" - | "wxClipboardTextEvent" - | "wxCloseEvent" - | "wxColourData" - | "wxColourDialog" - | "wxColourPickerCtrl" - | "wxColourPickerEvent" - | "wxComboBox" - | "wxCommandEvent" - | "wxContextMenuEvent" - | "wxControl" - | "wxControlWithItems" - | "wxCursor" - | "wxDC" - | "wxDCOverlay" - | "wxDataObject" - | "wxDateEvent" - | "wxDatePickerCtrl" - | "wxDialog" - | "wxDirDialog" - | "wxDirPickerCtrl" - | "wxDisplay" - | "wxDisplayChangedEvent" - | "wxDropFilesEvent" - | "wxEraseEvent" - | "wxEvent" - | "wxEvtHandler" - | "wxFileDataObject" - | "wxFileDialog" - | "wxFileDirPickerEvent" - | "wxFilePickerCtrl" - | "wxFindReplaceData" - | "wxFindReplaceDialog" - | "wxFlexGridSizer" - | "wxFocusEvent" - | "wxFont" - | "wxFontData" - | "wxFontDialog" - | "wxFontPickerCtrl" - | "wxFontPickerEvent" - | "wxFrame" - | "wxGBSizerItem" - | "wxGCDC" - | "wxGLCanvas" - | "wxGLContext" - | "wxGauge" - | "wxGenericDirCtrl" - | "wxGraphicsBrush" - | "wxGraphicsContext" - | "wxGraphicsFont" - | "wxGraphicsGradientStops" - | "wxGraphicsMatrix" - | "wxGraphicsObject" - | "wxGraphicsPath" - | "wxGraphicsPen" - | "wxGraphicsRenderer" - | "wxGrid" - | "wxGridBagSizer" - | "wxGridCellAttr" - | "wxGridCellBoolEditor" - | "wxGridCellBoolRenderer" - | "wxGridCellChoiceEditor" - | "wxGridCellEditor" - | "wxGridCellFloatEditor" - | "wxGridCellFloatRenderer" - | "wxGridCellNumberEditor" - | "wxGridCellNumberRenderer" - | "wxGridCellRenderer" - | "wxGridCellStringRenderer" - | "wxGridCellTextEditor" - | "wxGridEvent" - | "wxGridSizer" - | "wxHelpEvent" - | "wxHtmlEasyPrinting" - | "wxHtmlLinkEvent" - | "wxHtmlWindow" - | "wxIcon" - | "wxIconBundle" - | "wxIconizeEvent" - | "wxIdleEvent" - | "wxImage" - | "wxImageList" - | "wxInitDialogEvent" - | "wxJoystickEvent" - | "wxKeyEvent" - | "wxLayoutAlgorithm" - | "wxListBox" - | "wxListCtrl" - | "wxListEvent" - | "wxListItem" - | "wxListItemAttr" - | "wxListView" - | "wxListbook" - | "wxLocale" - | "wxLogNull" - | "wxMDIChildFrame" - | "wxMDIClientWindow" - | "wxMDIParentFrame" - | "wxMask" - | "wxMaximizeEvent" - | "wxMemoryDC" - | "wxMenu" - | "wxMenuBar" - | "wxMenuEvent" - | "wxMenuItem" - | "wxMessageDialog" - | "wxMiniFrame" - | "wxMirrorDC" - | "wxMouseCaptureChangedEvent" - | "wxMouseCaptureLostEvent" - | "wxMouseEvent" - | "wxMoveEvent" - | "wxMultiChoiceDialog" - | "wxNavigationKeyEvent" - | "wxNotebook" - | "wxNotificationMessage" - | "wxNotifyEvent" - | "wxOverlay" - | "wxPageSetupDialog" - | "wxPageSetupDialogData" - | "wxPaintDC" - | "wxPaintEvent" - | "wxPalette" - | "wxPaletteChangedEvent" - | "wxPanel" - | "wxPasswordEntryDialog" - | "wxPen" - | "wxPickerBase" - | "wxPopupTransientWindow" - | "wxPopupWindow" - | "wxPostScriptDC" - | "wxPreviewCanvas" - | "wxPreviewControlBar" - | "wxPreviewFrame" - | "wxPrintData" - | "wxPrintDialog" - | "wxPrintDialogData" - | "wxPrintPreview" - | "wxPrinter" - | "wxPrintout" - | "wxProgressDialog" - | "wxQueryNewPaletteEvent" - | "wxRadioBox" - | "wxRadioButton" - | "wxRegion" - | "wxSashEvent" - | "wxSashLayoutWindow" - | "wxSashWindow" - | "wxScreenDC" - | "wxScrollBar" - | "wxScrollEvent" - | "wxScrollWinEvent" - | "wxScrolledWindow" - | "wxSetCursorEvent" - | "wxShowEvent" - | "wxSingleChoiceDialog" - | "wxSizeEvent" - | "wxSizer" - | "wxSizerFlags" - | "wxSizerItem" - | "wxSlider" - | "wxSpinButton" - | "wxSpinCtrl" - | "wxSpinEvent" - | "wxSplashScreen" - | "wxSplitterEvent" - | "wxSplitterWindow" - | "wxStaticBitmap" - | "wxStaticBox" - | "wxStaticBoxSizer" - | "wxStaticLine" - | "wxStaticText" - | "wxStatusBar" - | "wxStdDialogButtonSizer" - | "wxStyledTextCtrl" - | "wxStyledTextEvent" - | "wxSysColourChangedEvent" - | "wxSystemOptions" - | "wxSystemSettings" - | "wxTaskBarIcon" - | "wxTaskBarIconEvent" - | "wxTextAttr" - | "wxTextCtrl" - | "wxTextDataObject" - | "wxTextEntryDialog" - | "wxToggleButton" - | "wxToolBar" - | "wxToolTip" - | "wxToolbook" - | "wxTopLevelWindow" - | "wxTreeCtrl" - | "wxTreeEvent" - | "wxTreebook" - | "wxUpdateUIEvent" - | "wxWebView" - | "wxWebViewEvent" - | "wxWindow" - | "wxWindowCreateEvent" - | "wxWindowDC" - | "wxWindowDestroyEvent" - | "wxXmlResource" - | "wx_misc" - | "wx_object" - | "wxe_master" - | "wxe_server" - | "wxe_util" - | "xmerl" - | "xmerl_b64Bin" - | "xmerl_b64Bin_scan" - | "xmerl_eventp" - | "xmerl_html" - | "xmerl_lib" - | "xmerl_otpsgml" - | "xmerl_regexp" - | "xmerl_sax_old_dom" - | "xmerl_sax_parser" - | "xmerl_sax_parser_latin1" - | "xmerl_sax_parser_list" - | "xmerl_sax_parser_utf16be" - | "xmerl_sax_parser_utf16le" - | "xmerl_sax_parser_utf8" - | "xmerl_sax_simple_dom" - | "xmerl_scan" - | "xmerl_sgml" - | "xmerl_simple" - | "xmerl_text" - | "xmerl_ucs" - | "xmerl_uri" - | "xmerl_validate" - | "xmerl_xlate" - | "xmerl_xml" - | "xmerl_xpath" - | "xmerl_xpath_lib" - | "xmerl_xpath_parse" - | "xmerl_xpath_pred" - | "xmerl_xpath_scan" - | "xmerl_xs" - | "xmerl_xsd" - | "xmerl_xsd_type" - | "xref" - | "xref_base" - | "xref_compiler" - | "xref_parser" - | "xref_reader" - | "xref_scanner" - | "xref_utils" - | "yecc" - | "yeccparser" - | "yeccscan" - | "zip" - | "zlib" => (), - _ => return Ok(()), - } - - Err(Error::GleamModuleWouldOverwriteStandardErlangModule { - name: name.into(), - path: path.to_owned(), - }) + // These names were got with this Erlang + // + // ```erl + // file:write_file("names.txt", lists:join("\n",lists:map(fun(T) -> erlang:element(1, T) end, code:all_available()))). + // ``` + // + match input.name.as_str() { + "alarm_handler" + | "application" + | "application_controller" + | "application_master" + | "application_starter" + | "appmon_info" + | "argparse" + | "array" + | "asn1_db" + | "asn1ct" + | "asn1ct_check" + | "asn1ct_constructed_ber_bin_v2" + | "asn1ct_constructed_per" + | "asn1ct_eval_ext" + | "asn1ct_func" + | "asn1ct_gen" + | "asn1ct_gen_ber_bin_v2" + | "asn1ct_gen_check" + | "asn1ct_gen_jer" + | "asn1ct_gen_per" + | "asn1ct_imm" + | "asn1ct_name" + | "asn1ct_parser2" + | "asn1ct_pretty_format" + | "asn1ct_rtt" + | "asn1ct_table" + | "asn1ct_tok" + | "asn1ct_value" + | "asn1rt_nif" + | "atomics" + | "auth" + | "base64" + | "beam_a" + | "beam_asm" + | "beam_block" + | "beam_bounds" + | "beam_call_types" + | "beam_clean" + | "beam_dict" + | "beam_digraph" + | "beam_disasm" + | "beam_flatten" + | "beam_jump" + | "beam_kernel_to_ssa" + | "beam_lib" + | "beam_listing" + | "beam_opcodes" + | "beam_ssa" + | "beam_ssa_alias" + | "beam_ssa_bc_size" + | "beam_ssa_bool" + | "beam_ssa_bsm" + | "beam_ssa_check" + | "beam_ssa_codegen" + | "beam_ssa_dead" + | "beam_ssa_lint" + | "beam_ssa_opt" + | "beam_ssa_pp" + | "beam_ssa_pre_codegen" + | "beam_ssa_private_append" + | "beam_ssa_recv" + | "beam_ssa_share" + | "beam_ssa_throw" + | "beam_ssa_type" + | "beam_trim" + | "beam_types" + | "beam_utils" + | "beam_validator" + | "beam_z" + | "binary" + | "c" + | "calendar" + | "cdv_atom_cb" + | "cdv_bin_cb" + | "cdv_detail_wx" + | "cdv_dist_cb" + | "cdv_ets_cb" + | "cdv_fun_cb" + | "cdv_gen_cb" + | "cdv_html_wx" + | "cdv_info_wx" + | "cdv_int_tab_cb" + | "cdv_mem_cb" + | "cdv_mod_cb" + | "cdv_multi_wx" + | "cdv_persistent_cb" + | "cdv_port_cb" + | "cdv_proc_cb" + | "cdv_sched_cb" + | "cdv_table_wx" + | "cdv_term_cb" + | "cdv_timer_cb" + | "cdv_virtual_list_wx" + | "cdv_wx" + | "cerl" + | "cerl_clauses" + | "cerl_inline" + | "cerl_prettypr" + | "cerl_trees" + | "code" + | "code_server" + | "compile" + | "core_lib" + | "core_lint" + | "core_parse" + | "core_pp" + | "core_scan" + | "counters" + | "cover" + | "cprof" + | "cpu_sup" + | "crashdump_viewer" + | "crypto" + | "crypto_ec_curves" + | "ct" + | "ct_config" + | "ct_config_plain" + | "ct_config_xml" + | "ct_conn_log_h" + | "ct_cover" + | "ct_default_gl" + | "ct_event" + | "ct_framework" + | "ct_ftp" + | "ct_gen_conn" + | "ct_groups" + | "ct_hooks" + | "ct_hooks_lock" + | "ct_logs" + | "ct_make" + | "ct_master" + | "ct_master_event" + | "ct_master_logs" + | "ct_master_status" + | "ct_netconfc" + | "ct_property_test" + | "ct_release_test" + | "ct_repeat" + | "ct_rpc" + | "ct_run" + | "ct_slave" + | "ct_snmp" + | "ct_ssh" + | "ct_suite" + | "ct_telnet" + | "ct_telnet_client" + | "ct_testspec" + | "ct_util" + | "cth_conn_log" + | "cth_log_redirect" + | "cth_surefire" + | "dbg" + | "dbg_debugged" + | "dbg_icmd" + | "dbg_idb" + | "dbg_ieval" + | "dbg_iload" + | "dbg_iserver" + | "dbg_istk" + | "dbg_wx_break" + | "dbg_wx_break_win" + | "dbg_wx_code" + | "dbg_wx_filedialog_win" + | "dbg_wx_interpret" + | "dbg_wx_mon" + | "dbg_wx_mon_win" + | "dbg_wx_settings" + | "dbg_wx_src_view" + | "dbg_wx_trace" + | "dbg_wx_trace_win" + | "dbg_wx_view" + | "dbg_wx_win" + | "dbg_wx_winman" + | "debugger" + | "dets" + | "dets_server" + | "dets_sup" + | "dets_utils" + | "dets_v9" + | "dialyzer" + | "dialyzer_analysis_callgraph" + | "dialyzer_behaviours" + | "dialyzer_callgraph" + | "dialyzer_cl" + | "dialyzer_cl_parse" + | "dialyzer_clean_core" + | "dialyzer_codeserver" + | "dialyzer_contracts" + | "dialyzer_coordinator" + | "dialyzer_cplt" + | "dialyzer_dataflow" + | "dialyzer_dep" + | "dialyzer_dot" + | "dialyzer_explanation" + | "dialyzer_gui_wx" + | "dialyzer_incremental" + | "dialyzer_iplt" + | "dialyzer_options" + | "dialyzer_plt" + | "dialyzer_succ_typings" + | "dialyzer_timing" + | "dialyzer_typegraph" + | "dialyzer_typesig" + | "dialyzer_utils" + | "dialyzer_worker" + | "diameter" + | "diameter_app" + | "diameter_callback" + | "diameter_capx" + | "diameter_codec" + | "diameter_codegen" + | "diameter_config" + | "diameter_config_sup" + | "diameter_dbg" + | "diameter_dict_parser" + | "diameter_dict_scanner" + | "diameter_dict_util" + | "diameter_dist" + | "diameter_etcp" + | "diameter_etcp_sup" + | "diameter_exprecs" + | "diameter_gen" + | "diameter_gen_acct_rfc6733" + | "diameter_gen_base_accounting" + | "diameter_gen_base_rfc3588" + | "diameter_gen_base_rfc6733" + | "diameter_gen_doic_rfc7683" + | "diameter_gen_relay" + | "diameter_info" + | "diameter_lib" + | "diameter_make" + | "diameter_misc_sup" + | "diameter_peer" + | "diameter_peer_fsm" + | "diameter_peer_fsm_sup" + | "diameter_reg" + | "diameter_sctp" + | "diameter_sctp_sup" + | "diameter_service" + | "diameter_service_sup" + | "diameter_session" + | "diameter_stats" + | "diameter_sup" + | "diameter_sync" + | "diameter_tcp" + | "diameter_tcp_sup" + | "diameter_traffic" + | "diameter_transport" + | "diameter_transport_sup" + | "diameter_types" + | "diameter_watchdog" + | "diameter_watchdog_sup" + | "dict" + | "digraph" + | "digraph_utils" + | "disk_log" + | "disk_log_1" + | "disk_log_server" + | "disk_log_sup" + | "disksup" + | "dist_ac" + | "dist_util" + | "docgen_edoc_xml_cb" + | "docgen_otp_specs" + | "docgen_xmerl_xml_cb" + | "docgen_xml_to_chunk" + | "dtls_connection" + | "dtls_connection_sup" + | "dtls_gen_connection" + | "dtls_handshake" + | "dtls_listener_sup" + | "dtls_packet_demux" + | "dtls_record" + | "dtls_server_session_cache_sup" + | "dtls_server_sup" + | "dtls_socket" + | "dtls_sup" + | "dtls_v1" + | "dyntrace" + | "edlin" + | "edlin_context" + | "edlin_expand" + | "edlin_key" + | "edlin_type_suggestion" + | "edoc" + | "edoc_cli" + | "edoc_data" + | "edoc_doclet" + | "edoc_doclet_chunks" + | "edoc_extract" + | "edoc_layout" + | "edoc_layout_chunks" + | "edoc_lib" + | "edoc_macros" + | "edoc_parser" + | "edoc_refs" + | "edoc_report" + | "edoc_run" + | "edoc_scanner" + | "edoc_specs" + | "edoc_tags" + | "edoc_types" + | "edoc_wiki" + | "eldap" + | "epp" + | "epp_dodger" + | "eprof" + | "erl2html2" + | "erl_abstract_code" + | "erl_anno" + | "erl_bif_types" + | "erl_bifs" + | "erl_bits" + | "erl_boot_server" + | "erl_comment_scan" + | "erl_compile" + | "erl_compile_server" + | "erl_ddll" + | "erl_distribution" + | "erl_epmd" + | "erl_error" + | "erl_erts_errors" + | "erl_eval" + | "erl_expand_records" + | "erl_features" + | "erl_init" + | "erl_internal" + | "erl_kernel_errors" + | "erl_lint" + | "erl_parse" + | "erl_posix_msg" + | "erl_pp" + | "erl_prettypr" + | "erl_prim_loader" + | "erl_recomment" + | "erl_reply" + | "erl_scan" + | "erl_signal_handler" + | "erl_stdlib_errors" + | "erl_syntax" + | "erl_syntax_lib" + | "erl_tar" + | "erl_tracer" + | "erl_types" + | "erlang" + | "erlsrv" + | "erpc" + | "error_handler" + | "error_logger" + | "error_logger_file_h" + | "error_logger_tty_h" + | "erts_alloc_config" + | "erts_code_purger" + | "erts_debug" + | "erts_dirty_process_signal_handler" + | "erts_internal" + | "erts_literal_area_collector" + | "escript" + | "et" + | "et_collector" + | "et_selector" + | "et_viewer" + | "et_wx_contents_viewer" + | "et_wx_viewer" + | "etop" + | "etop_tr" + | "etop_txt" + | "ets" + | "eunit" + | "eunit_autoexport" + | "eunit_data" + | "eunit_lib" + | "eunit_listener" + | "eunit_proc" + | "eunit_serial" + | "eunit_server" + | "eunit_striptests" + | "eunit_surefire" + | "eunit_test" + | "eunit_tests" + | "eunit_tty" + | "eval_bits" + | "file" + | "file_io_server" + | "file_server" + | "file_sorter" + | "filelib" + | "filename" + | "format_lib_supp" + | "fprof" + | "ftp" + | "ftp_app" + | "ftp_internal" + | "ftp_progress" + | "ftp_response" + | "ftp_sup" + | "gb_sets" + | "gb_trees" + | "gen" + | "gen_event" + | "gen_fsm" + | "gen_sctp" + | "gen_server" + | "gen_statem" + | "gen_tcp" + | "gen_tcp_socket" + | "gen_udp" + | "gen_udp_socket" + | "gl" + | "global" + | "global_group" + | "global_search" + | "glu" + | "group" + | "group_history" + | "heart" + | "http_chunk" + | "http_request" + | "http_response" + | "http_transport" + | "http_uri" + | "http_util" + | "httpc" + | "httpc_cookie" + | "httpc_handler" + | "httpc_handler_sup" + | "httpc_manager" + | "httpc_profile_sup" + | "httpc_request" + | "httpc_response" + | "httpc_sup" + | "httpd" + | "httpd_acceptor" + | "httpd_acceptor_sup" + | "httpd_cgi" + | "httpd_conf" + | "httpd_connection_sup" + | "httpd_custom" + | "httpd_custom_api" + | "httpd_esi" + | "httpd_example" + | "httpd_file" + | "httpd_instance_sup" + | "httpd_log" + | "httpd_logger" + | "httpd_manager" + | "httpd_misc_sup" + | "httpd_request" + | "httpd_request_handler" + | "httpd_response" + | "httpd_script_env" + | "httpd_socket" + | "httpd_sup" + | "httpd_util" + | "i" + | "inet" + | "inet6_sctp" + | "inet6_tcp" + | "inet6_tcp_dist" + | "inet6_tls_dist" + | "inet6_udp" + | "inet_config" + | "inet_db" + | "inet_dns" + | "inet_epmd_dist" + | "inet_epmd_socket" + | "inet_gethost_native" + | "inet_hosts" + | "inet_parse" + | "inet_res" + | "inet_sctp" + | "inet_tcp" + | "inet_tcp_dist" + | "inet_tls_dist" + | "inet_udp" + | "inets" + | "inets_app" + | "inets_lib" + | "inets_service" + | "inets_sup" + | "inets_trace" + | "init" + | "instrument" + | "int" + | "io" + | "io_lib" + | "io_lib_format" + | "io_lib_fread" + | "io_lib_pretty" + | "kernel" + | "kernel_config" + | "kernel_refc" + | "lcnt" + | "leex" + | "lists" + | "local_tcp" + | "local_udp" + | "log_mf_h" + | "logger" + | "logger_backend" + | "logger_config" + | "logger_disk_log_h" + | "logger_filters" + | "logger_formatter" + | "logger_h_common" + | "logger_handler_watcher" + | "logger_olp" + | "logger_proxy" + | "logger_server" + | "logger_simple_h" + | "logger_std_h" + | "logger_sup" + | "make" + | "maps" + | "math" + | "megaco" + | "megaco_ber_encoder" + | "megaco_ber_media_gateway_control_v1" + | "megaco_ber_media_gateway_control_v2" + | "megaco_ber_media_gateway_control_v3" + | "megaco_binary_encoder" + | "megaco_binary_encoder_lib" + | "megaco_binary_name_resolver_v1" + | "megaco_binary_name_resolver_v2" + | "megaco_binary_name_resolver_v3" + | "megaco_binary_term_id" + | "megaco_binary_term_id_gen" + | "megaco_binary_transformer_v1" + | "megaco_binary_transformer_v2" + | "megaco_binary_transformer_v3" + | "megaco_compact_text_encoder" + | "megaco_compact_text_encoder_v1" + | "megaco_compact_text_encoder_v2" + | "megaco_compact_text_encoder_v3" + | "megaco_config" + | "megaco_config_misc" + | "megaco_digit_map" + | "megaco_edist_compress" + | "megaco_encoder" + | "megaco_erl_dist_encoder" + | "megaco_erl_dist_encoder_mc" + | "megaco_filter" + | "megaco_flex_scanner" + | "megaco_flex_scanner_handler" + | "megaco_messenger" + | "megaco_messenger_misc" + | "megaco_misc_sup" + | "megaco_monitor" + | "megaco_per_encoder" + | "megaco_per_media_gateway_control_v1" + | "megaco_per_media_gateway_control_v2" + | "megaco_per_media_gateway_control_v3" + | "megaco_pretty_text_encoder" + | "megaco_pretty_text_encoder_v1" + | "megaco_pretty_text_encoder_v2" + | "megaco_pretty_text_encoder_v3" + | "megaco_sdp" + | "megaco_stats" + | "megaco_sup" + | "megaco_tcp" + | "megaco_tcp_accept" + | "megaco_tcp_accept_sup" + | "megaco_tcp_connection" + | "megaco_tcp_connection_sup" + | "megaco_tcp_sup" + | "megaco_text_mini_decoder" + | "megaco_text_mini_parser" + | "megaco_text_parser_v1" + | "megaco_text_parser_v2" + | "megaco_text_parser_v3" + | "megaco_text_scanner" + | "megaco_timer" + | "megaco_trans_sender" + | "megaco_trans_sup" + | "megaco_transport" + | "megaco_udp" + | "megaco_udp_server" + | "megaco_udp_sup" + | "megaco_user" + | "megaco_user_default" + | "memsup" + | "merl" + | "merl_transform" + | "misc_supp" + | "mnesia" + | "mnesia_app" + | "mnesia_backend_type" + | "mnesia_backup" + | "mnesia_bup" + | "mnesia_checkpoint" + | "mnesia_checkpoint_sup" + | "mnesia_controller" + | "mnesia_dumper" + | "mnesia_event" + | "mnesia_ext_sup" + | "mnesia_frag" + | "mnesia_frag_hash" + | "mnesia_index" + | "mnesia_kernel_sup" + | "mnesia_late_loader" + | "mnesia_lib" + | "mnesia_loader" + | "mnesia_locker" + | "mnesia_log" + | "mnesia_monitor" + | "mnesia_recover" + | "mnesia_registry" + | "mnesia_rpc" + | "mnesia_schema" + | "mnesia_snmp_hook" + | "mnesia_sp" + | "mnesia_subscr" + | "mnesia_sup" + | "mnesia_text" + | "mnesia_tm" + | "mod_actions" + | "mod_alias" + | "mod_auth" + | "mod_auth_dets" + | "mod_auth_mnesia" + | "mod_auth_plain" + | "mod_auth_server" + | "mod_cgi" + | "mod_dir" + | "mod_disk_log" + | "mod_esi" + | "mod_get" + | "mod_head" + | "mod_log" + | "mod_range" + | "mod_responsecontrol" + | "mod_security" + | "mod_security_server" + | "mod_trace" + | "ms_transform" + | "msacc" + | "net" + | "net_adm" + | "net_kernel" + | "nteventlog" + | "observer" + | "observer_alloc_wx" + | "observer_app_wx" + | "observer_backend" + | "observer_html_lib" + | "observer_lib" + | "observer_perf_wx" + | "observer_port_wx" + | "observer_pro_wx" + | "observer_procinfo" + | "observer_sock_wx" + | "observer_sys_wx" + | "observer_trace_wx" + | "observer_traceoptions_wx" + | "observer_tv_table" + | "observer_tv_wx" + | "observer_wx" + | "orddict" + | "ordsets" + | "os" + | "os_mon" + | "os_mon_mib" + | "os_mon_sysinfo" + | "os_sup" + | "otp_internal" + | "peer" + | "persistent_term" + | "pg" + | "pg2" + | "pool" + | "prettypr" + | "prim_buffer" + | "prim_eval" + | "prim_file" + | "prim_inet" + | "prim_net" + | "prim_socket" + | "prim_tty" + | "prim_zip" + | "proc_lib" + | "proplists" + | "pubkey_cert" + | "pubkey_cert_records" + | "pubkey_crl" + | "pubkey_ocsp" + | "pubkey_os_cacerts" + | "pubkey_pbe" + | "pubkey_pem" + | "pubkey_policy_tree" + | "pubkey_ssh" + | "public_key" + | "qlc" + | "qlc_pt" + | "queue" + | "ram_file" + | "rand" + | "random" + | "raw_file_io" + | "raw_file_io_compressed" + | "raw_file_io_deflate" + | "raw_file_io_delayed" + | "raw_file_io_inflate" + | "raw_file_io_list" + | "rb" + | "rb_format_supp" + | "re" + | "rec_env" + | "release_handler" + | "release_handler_1" + | "reltool" + | "reltool_app_win" + | "reltool_fgraph" + | "reltool_fgraph_win" + | "reltool_mod_win" + | "reltool_server" + | "reltool_sys_win" + | "reltool_target" + | "reltool_utils" + | "rpc" + | "runtime_tools" + | "runtime_tools_sup" + | "sasl" + | "sasl_report" + | "sasl_report_file_h" + | "sasl_report_tty_h" + | "scheduler" + | "seq_trace" + | "sets" + | "shell" + | "shell_default" + | "shell_docs" + | "slave" + | "snmp" + | "snmp_app" + | "snmp_app_sup" + | "snmp_community_mib" + | "snmp_conf" + | "snmp_config" + | "snmp_framework_mib" + | "snmp_generic" + | "snmp_generic_mnesia" + | "snmp_index" + | "snmp_log" + | "snmp_mini_mib" + | "snmp_misc" + | "snmp_note_store" + | "snmp_notification_mib" + | "snmp_pdus" + | "snmp_shadow_table" + | "snmp_standard_mib" + | "snmp_target_mib" + | "snmp_user_based_sm_mib" + | "snmp_usm" + | "snmp_verbosity" + | "snmp_view_based_acm_mib" + | "snmpa" + | "snmpa_acm" + | "snmpa_agent" + | "snmpa_agent_sup" + | "snmpa_app" + | "snmpa_authentication_service" + | "snmpa_conf" + | "snmpa_discovery_handler" + | "snmpa_discovery_handler_default" + | "snmpa_error" + | "snmpa_error_io" + | "snmpa_error_logger" + | "snmpa_error_report" + | "snmpa_get" + | "snmpa_get_lib" + | "snmpa_get_mechanism" + | "snmpa_local_db" + | "snmpa_mib" + | "snmpa_mib_data" + | "snmpa_mib_data_tttn" + | "snmpa_mib_lib" + | "snmpa_mib_storage" + | "snmpa_mib_storage_dets" + | "snmpa_mib_storage_ets" + | "snmpa_mib_storage_mnesia" + | "snmpa_misc_sup" + | "snmpa_mpd" + | "snmpa_net_if" + | "snmpa_net_if_filter" + | "snmpa_network_interface" + | "snmpa_network_interface_filter" + | "snmpa_notification_delivery_info_receiver" + | "snmpa_notification_filter" + | "snmpa_set" + | "snmpa_set_lib" + | "snmpa_set_mechanism" + | "snmpa_supervisor" + | "snmpa_svbl" + | "snmpa_symbolic_store" + | "snmpa_target_cache" + | "snmpa_trap" + | "snmpa_usm" + | "snmpa_vacm" + | "snmpc" + | "snmpc_lib" + | "snmpc_mib_gram" + | "snmpc_mib_to_hrl" + | "snmpc_misc" + | "snmpc_tok" + | "snmpm" + | "snmpm_conf" + | "snmpm_config" + | "snmpm_misc_sup" + | "snmpm_mpd" + | "snmpm_net_if" + | "snmpm_net_if_filter" + | "snmpm_net_if_mt" + | "snmpm_network_interface" + | "snmpm_network_interface_filter" + | "snmpm_server" + | "snmpm_server_sup" + | "snmpm_supervisor" + | "snmpm_user" + | "snmpm_user_default" + | "snmpm_user_old" + | "snmpm_usm" + | "socket" + | "socket_registry" + | "sofs" + | "ssh" + | "ssh_acceptor" + | "ssh_acceptor_sup" + | "ssh_agent" + | "ssh_app" + | "ssh_auth" + | "ssh_bits" + | "ssh_channel" + | "ssh_channel_sup" + | "ssh_cli" + | "ssh_client_channel" + | "ssh_client_key_api" + | "ssh_connection" + | "ssh_connection_handler" + | "ssh_daemon_channel" + | "ssh_dbg" + | "ssh_file" + | "ssh_fsm_kexinit" + | "ssh_fsm_userauth_client" + | "ssh_fsm_userauth_server" + | "ssh_info" + | "ssh_io" + | "ssh_lib" + | "ssh_message" + | "ssh_no_io" + | "ssh_options" + | "ssh_server_channel" + | "ssh_server_key_api" + | "ssh_sftp" + | "ssh_sftpd" + | "ssh_sftpd_file" + | "ssh_sftpd_file_api" + | "ssh_shell" + | "ssh_subsystem_sup" + | "ssh_system_sup" + | "ssh_tcpip_forward_acceptor" + | "ssh_tcpip_forward_acceptor_sup" + | "ssh_tcpip_forward_client" + | "ssh_tcpip_forward_srv" + | "ssh_transport" + | "ssh_xfer" + | "ssl" + | "ssl_admin_sup" + | "ssl_alert" + | "ssl_app" + | "ssl_certificate" + | "ssl_cipher" + | "ssl_cipher_format" + | "ssl_client_session_cache_db" + | "ssl_config" + | "ssl_connection_sup" + | "ssl_crl" + | "ssl_crl_cache" + | "ssl_crl_cache_api" + | "ssl_crl_hash_dir" + | "ssl_dh_groups" + | "ssl_dist_admin_sup" + | "ssl_dist_connection_sup" + | "ssl_dist_sup" + | "ssl_gen_statem" + | "ssl_handshake" + | "ssl_listen_tracker_sup" + | "ssl_logger" + | "ssl_manager" + | "ssl_pem_cache" + | "ssl_pkix_db" + | "ssl_record" + | "ssl_server_session_cache" + | "ssl_server_session_cache_db" + | "ssl_server_session_cache_sup" + | "ssl_session" + | "ssl_session_cache_api" + | "ssl_srp_primes" + | "ssl_sup" + | "ssl_trace" + | "ssl_upgrade_server_session_cache_sup" + | "standard_error" + | "string" + | "supervisor" + | "supervisor_bridge" + | "sys" + | "sys_core_alias" + | "sys_core_bsm" + | "sys_core_fold" + | "sys_core_fold_lists" + | "sys_core_inline" + | "sys_core_prepare" + | "sys_messages" + | "sys_pre_attributes" + | "system_information" + | "systools" + | "systools_lib" + | "systools_make" + | "systools_rc" + | "systools_relup" + | "tags" + | "test_server" + | "test_server_ctrl" + | "test_server_gl" + | "test_server_io" + | "test_server_node" + | "test_server_sup" + | "tftp" + | "tftp_app" + | "tftp_binary" + | "tftp_engine" + | "tftp_file" + | "tftp_lib" + | "tftp_logger" + | "tftp_sup" + | "timer" + | "tls_bloom_filter" + | "tls_client_connection_1_3" + | "tls_client_ticket_store" + | "tls_connection" + | "tls_connection_sup" + | "tls_dist_server_sup" + | "tls_dist_sup" + | "tls_dtls_connection" + | "tls_dyn_connection_sup" + | "tls_gen_connection" + | "tls_gen_connection_1_3" + | "tls_handshake" + | "tls_handshake_1_3" + | "tls_record" + | "tls_record_1_3" + | "tls_sender" + | "tls_server_connection_1_3" + | "tls_server_session_ticket" + | "tls_server_session_ticket_sup" + | "tls_server_sup" + | "tls_socket" + | "tls_sup" + | "tls_v1" + | "ttb" + | "ttb_autostart" + | "ttb_et" + | "typer" + | "typer_core" + | "unicode" + | "unicode_util" + | "unix_telnet" + | "uri_string" + | "user_drv" + | "user_sup" + | "v3_core" + | "v3_kernel" + | "v3_kernel_pp" + | "win32reg" + | "wrap_log_reader" + | "wx" + | "wxAcceleratorEntry" + | "wxAcceleratorTable" + | "wxActivateEvent" + | "wxArtProvider" + | "wxAuiDockArt" + | "wxAuiManager" + | "wxAuiManagerEvent" + | "wxAuiNotebook" + | "wxAuiNotebookEvent" + | "wxAuiPaneInfo" + | "wxAuiSimpleTabArt" + | "wxAuiTabArt" + | "wxBitmap" + | "wxBitmapButton" + | "wxBitmapDataObject" + | "wxBookCtrlBase" + | "wxBookCtrlEvent" + | "wxBoxSizer" + | "wxBrush" + | "wxBufferedDC" + | "wxBufferedPaintDC" + | "wxButton" + | "wxCalendarCtrl" + | "wxCalendarDateAttr" + | "wxCalendarEvent" + | "wxCaret" + | "wxCheckBox" + | "wxCheckListBox" + | "wxChildFocusEvent" + | "wxChoice" + | "wxChoicebook" + | "wxClientDC" + | "wxClipboard" + | "wxClipboardTextEvent" + | "wxCloseEvent" + | "wxColourData" + | "wxColourDialog" + | "wxColourPickerCtrl" + | "wxColourPickerEvent" + | "wxComboBox" + | "wxCommandEvent" + | "wxContextMenuEvent" + | "wxControl" + | "wxControlWithItems" + | "wxCursor" + | "wxDC" + | "wxDCOverlay" + | "wxDataObject" + | "wxDateEvent" + | "wxDatePickerCtrl" + | "wxDialog" + | "wxDirDialog" + | "wxDirPickerCtrl" + | "wxDisplay" + | "wxDisplayChangedEvent" + | "wxDropFilesEvent" + | "wxEraseEvent" + | "wxEvent" + | "wxEvtHandler" + | "wxFileDataObject" + | "wxFileDialog" + | "wxFileDirPickerEvent" + | "wxFilePickerCtrl" + | "wxFindReplaceData" + | "wxFindReplaceDialog" + | "wxFlexGridSizer" + | "wxFocusEvent" + | "wxFont" + | "wxFontData" + | "wxFontDialog" + | "wxFontPickerCtrl" + | "wxFontPickerEvent" + | "wxFrame" + | "wxGBSizerItem" + | "wxGCDC" + | "wxGLCanvas" + | "wxGLContext" + | "wxGauge" + | "wxGenericDirCtrl" + | "wxGraphicsBrush" + | "wxGraphicsContext" + | "wxGraphicsFont" + | "wxGraphicsGradientStops" + | "wxGraphicsMatrix" + | "wxGraphicsObject" + | "wxGraphicsPath" + | "wxGraphicsPen" + | "wxGraphicsRenderer" + | "wxGrid" + | "wxGridBagSizer" + | "wxGridCellAttr" + | "wxGridCellBoolEditor" + | "wxGridCellBoolRenderer" + | "wxGridCellChoiceEditor" + | "wxGridCellEditor" + | "wxGridCellFloatEditor" + | "wxGridCellFloatRenderer" + | "wxGridCellNumberEditor" + | "wxGridCellNumberRenderer" + | "wxGridCellRenderer" + | "wxGridCellStringRenderer" + | "wxGridCellTextEditor" + | "wxGridEvent" + | "wxGridSizer" + | "wxHelpEvent" + | "wxHtmlEasyPrinting" + | "wxHtmlLinkEvent" + | "wxHtmlWindow" + | "wxIcon" + | "wxIconBundle" + | "wxIconizeEvent" + | "wxIdleEvent" + | "wxImage" + | "wxImageList" + | "wxInitDialogEvent" + | "wxJoystickEvent" + | "wxKeyEvent" + | "wxLayoutAlgorithm" + | "wxListBox" + | "wxListCtrl" + | "wxListEvent" + | "wxListItem" + | "wxListItemAttr" + | "wxListView" + | "wxListbook" + | "wxLocale" + | "wxLogNull" + | "wxMDIChildFrame" + | "wxMDIClientWindow" + | "wxMDIParentFrame" + | "wxMask" + | "wxMaximizeEvent" + | "wxMemoryDC" + | "wxMenu" + | "wxMenuBar" + | "wxMenuEvent" + | "wxMenuItem" + | "wxMessageDialog" + | "wxMiniFrame" + | "wxMirrorDC" + | "wxMouseCaptureChangedEvent" + | "wxMouseCaptureLostEvent" + | "wxMouseEvent" + | "wxMoveEvent" + | "wxMultiChoiceDialog" + | "wxNavigationKeyEvent" + | "wxNotebook" + | "wxNotificationMessage" + | "wxNotifyEvent" + | "wxOverlay" + | "wxPageSetupDialog" + | "wxPageSetupDialogData" + | "wxPaintDC" + | "wxPaintEvent" + | "wxPalette" + | "wxPaletteChangedEvent" + | "wxPanel" + | "wxPasswordEntryDialog" + | "wxPen" + | "wxPickerBase" + | "wxPopupTransientWindow" + | "wxPopupWindow" + | "wxPostScriptDC" + | "wxPreviewCanvas" + | "wxPreviewControlBar" + | "wxPreviewFrame" + | "wxPrintData" + | "wxPrintDialog" + | "wxPrintDialogData" + | "wxPrintPreview" + | "wxPrinter" + | "wxPrintout" + | "wxProgressDialog" + | "wxQueryNewPaletteEvent" + | "wxRadioBox" + | "wxRadioButton" + | "wxRegion" + | "wxSashEvent" + | "wxSashLayoutWindow" + | "wxSashWindow" + | "wxScreenDC" + | "wxScrollBar" + | "wxScrollEvent" + | "wxScrollWinEvent" + | "wxScrolledWindow" + | "wxSetCursorEvent" + | "wxShowEvent" + | "wxSingleChoiceDialog" + | "wxSizeEvent" + | "wxSizer" + | "wxSizerFlags" + | "wxSizerItem" + | "wxSlider" + | "wxSpinButton" + | "wxSpinCtrl" + | "wxSpinEvent" + | "wxSplashScreen" + | "wxSplitterEvent" + | "wxSplitterWindow" + | "wxStaticBitmap" + | "wxStaticBox" + | "wxStaticBoxSizer" + | "wxStaticLine" + | "wxStaticText" + | "wxStatusBar" + | "wxStdDialogButtonSizer" + | "wxStyledTextCtrl" + | "wxStyledTextEvent" + | "wxSysColourChangedEvent" + | "wxSystemOptions" + | "wxSystemSettings" + | "wxTaskBarIcon" + | "wxTaskBarIconEvent" + | "wxTextAttr" + | "wxTextCtrl" + | "wxTextDataObject" + | "wxTextEntryDialog" + | "wxToggleButton" + | "wxToolBar" + | "wxToolTip" + | "wxToolbook" + | "wxTopLevelWindow" + | "wxTreeCtrl" + | "wxTreeEvent" + | "wxTreebook" + | "wxUpdateUIEvent" + | "wxWebView" + | "wxWebViewEvent" + | "wxWindow" + | "wxWindowCreateEvent" + | "wxWindowDC" + | "wxWindowDestroyEvent" + | "wxXmlResource" + | "wx_misc" + | "wx_object" + | "wxe_master" + | "wxe_server" + | "wxe_util" + | "xmerl" + | "xmerl_b64Bin" + | "xmerl_b64Bin_scan" + | "xmerl_eventp" + | "xmerl_html" + | "xmerl_lib" + | "xmerl_otpsgml" + | "xmerl_regexp" + | "xmerl_sax_old_dom" + | "xmerl_sax_parser" + | "xmerl_sax_parser_latin1" + | "xmerl_sax_parser_list" + | "xmerl_sax_parser_utf16be" + | "xmerl_sax_parser_utf16le" + | "xmerl_sax_parser_utf8" + | "xmerl_sax_simple_dom" + | "xmerl_scan" + | "xmerl_sgml" + | "xmerl_simple" + | "xmerl_text" + | "xmerl_ucs" + | "xmerl_uri" + | "xmerl_validate" + | "xmerl_xlate" + | "xmerl_xml" + | "xmerl_xpath" + | "xmerl_xpath_lib" + | "xmerl_xpath_parse" + | "xmerl_xpath_pred" + | "xmerl_xpath_scan" + | "xmerl_xs" + | "xmerl_xsd" + | "xmerl_xsd_type" + | "xref" + | "xref_base" + | "xref_compiler" + | "xref_parser" + | "xref_reader" + | "xref_scanner" + | "xref_utils" + | "yecc" + | "yeccparser" + | "yeccscan" + | "zip" + | "zlib" => (), + _ => return Ok(()), } + + Err(Error::GleamModuleWouldOverwriteStandardErlangModule { + name: input.name.clone(), + path: input.path.to_owned(), + }) } fn convert_deps_tree_error(e: dep_tree::Error) -> Error { From 4551742ada613fcce64112e927f4ee9d32abfe5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krys=CC=8Ctof=20R=CC=8Ceza=CC=81c=CC=8C?= Date: Thu, 23 May 2024 21:06:28 +0200 Subject: [PATCH 3/8] Add arm docker image --- .github/workflows/release-containers.yaml | 22 +++++++++++++++++----- containers/elixir-alpine.dockerfile | 5 ++++- containers/elixir-slim.dockerfile | 5 ++++- containers/elixir.dockerfile | 5 ++++- containers/erlang-alpine.dockerfile | 5 ++++- containers/erlang-slim.dockerfile | 5 ++++- containers/erlang.dockerfile | 5 ++++- containers/node-alpine.dockerfile | 5 ++++- containers/node-slim.dockerfile | 5 ++++- containers/node.dockerfile | 5 ++++- 10 files changed, 53 insertions(+), 14 deletions(-) diff --git a/.github/workflows/release-containers.yaml b/.github/workflows/release-containers.yaml index 52dd69e1e..5cf7d76e6 100644 --- a/.github/workflows/release-containers.yaml +++ b/.github/workflows/release-containers.yaml @@ -66,22 +66,34 @@ jobs: echo "platform_version=$PLATFORM_VERSION" >> $GITHUB_OUTPUT echo "container_tag=$TAG" >> $GITHUB_OUTPUT - - name: Download Glistix archive from GitHub release + - name: Download Glistix archives from GitHub release env: GH_REPO: ${{ github.repository }} run: | VERSION=${{ steps.versions.outputs.v_version }} - URL=https://github.com/$GH_REPO/releases/download/$VERSION/glistix-$VERSION-x86_64-unknown-linux-musl.tar.gz - echo Downloading $URL - curl -Lo glistix.tar.gz $URL + + AMD_URL=https://github.com/$GH_REPO/releases/download/$VERSION/glistix-$VERSION-x86_64-unknown-linux-musl.tar.gz + ARM_URL=https://github.com/$GH_REPO/releases/download/$VERSION/glistix-$VERSION-aarch64-unknown-linux-musl.tar.gz + + echo Downloading amd $AMD_URL + curl -Lo glistix-amd.tar.gz $AMD_URL + + echo Downloading arm $ARM_URL + curl -Lo glistix-arm.tar.gz $ARM_URL - name: Unpack Glistix binary from archive - run: tar xf glistix.tar.gz + run: | + tar xf glistix-amd.tar.gz + mv glistix glistix-amd64 + + tar xf glistix-arm.tar.gz + mv glistix glistix-arm64 - name: Build and push uses: docker/build-push-action@v5 with: context: . + platforms: linux/amd64,linux/arm64 file: containers/${{ matrix.base-image }}.dockerfile push: true tags: ${{ steps.versions.outputs.container_tag }} diff --git a/containers/elixir-alpine.dockerfile b/containers/elixir-alpine.dockerfile index b18920263..939c2a8cd 100644 --- a/containers/elixir-alpine.dockerfile +++ b/containers/elixir-alpine.dockerfile @@ -1,3 +1,6 @@ FROM elixir:alpine -COPY glistix /bin + +ARG TARGETARCH +COPY glistix-${TARGETARCH} /bin/glistix + CMD ["glistix"] diff --git a/containers/elixir-slim.dockerfile b/containers/elixir-slim.dockerfile index ce0a027bc..638576628 100644 --- a/containers/elixir-slim.dockerfile +++ b/containers/elixir-slim.dockerfile @@ -1,3 +1,6 @@ FROM elixir:slim -COPY glistix /bin + +ARG TARGETARCH +COPY glistix-${TARGETARCH} /bin/glistix + CMD ["glistix"] diff --git a/containers/elixir.dockerfile b/containers/elixir.dockerfile index cb46bf2bb..fc1f24630 100644 --- a/containers/elixir.dockerfile +++ b/containers/elixir.dockerfile @@ -1,3 +1,6 @@ FROM elixir:latest -COPY glistix /bin + +ARG TARGETARCH +COPY glistix-${TARGETARCH} /bin/glistix + CMD ["glistix"] diff --git a/containers/erlang-alpine.dockerfile b/containers/erlang-alpine.dockerfile index 2e28be3c9..b42f909ba 100644 --- a/containers/erlang-alpine.dockerfile +++ b/containers/erlang-alpine.dockerfile @@ -1,3 +1,6 @@ FROM erlang:alpine -COPY glistix /bin + +ARG TARGETARCH +COPY glistix-${TARGETARCH} /bin/glistix + CMD ["glistix"] diff --git a/containers/erlang-slim.dockerfile b/containers/erlang-slim.dockerfile index 6458ba65c..63b39d1ab 100644 --- a/containers/erlang-slim.dockerfile +++ b/containers/erlang-slim.dockerfile @@ -1,3 +1,6 @@ FROM erlang:slim -COPY glistix /bin + +ARG TARGETARCH +COPY glistix-${TARGETARCH} /bin/glistix + CMD ["glistix"] diff --git a/containers/erlang.dockerfile b/containers/erlang.dockerfile index 70cf1fa49..0a8281cd4 100644 --- a/containers/erlang.dockerfile +++ b/containers/erlang.dockerfile @@ -1,3 +1,6 @@ FROM erlang:latest -COPY glistix /bin + +ARG TARGETARCH +COPY glistix-${TARGETARCH} /bin/glistix + CMD ["glistix"] diff --git a/containers/node-alpine.dockerfile b/containers/node-alpine.dockerfile index e6b59dff8..1432aa1b8 100644 --- a/containers/node-alpine.dockerfile +++ b/containers/node-alpine.dockerfile @@ -1,3 +1,6 @@ FROM node:alpine -COPY glistix /bin + +ARG TARGETARCH +COPY glistix-${TARGETARCH} /bin/glistix + CMD ["glistix"] diff --git a/containers/node-slim.dockerfile b/containers/node-slim.dockerfile index 7ed89f63b..789fbde46 100644 --- a/containers/node-slim.dockerfile +++ b/containers/node-slim.dockerfile @@ -1,3 +1,6 @@ FROM node:slim -COPY glistix /bin + +ARG TARGETARCH +COPY glistix-${TARGETARCH} /bin/glistix + CMD ["glistix"] diff --git a/containers/node.dockerfile b/containers/node.dockerfile index 08358f059..638bba346 100644 --- a/containers/node.dockerfile +++ b/containers/node.dockerfile @@ -1,3 +1,6 @@ FROM node:latest -COPY glistix /bin + +ARG TARGETARCH +COPY glistix-${TARGETARCH} /bin/glistix + CMD ["glistix"] From c377e0a0eb0e35a39ae9537cf8c0d2f5ba93bf63 Mon Sep 17 00:00:00 2001 From: Louis Pilfold Date: Wed, 29 May 2024 11:17:45 +0100 Subject: [PATCH 4/8] Update hexpm-rust Closes https://github.com/gleam-lang/gleam/issues/3201 Closes https://github.com/gleam-lang/gleam/issues/2618 --- CHANGELOG.md | 4 ++++ Cargo.lock | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 43707032e..c019b71cb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,3 +15,7 @@ - Fixed a bug where the compiler could fail to detect modules that would clash with Erlang modules. ([Louis Pilfold](https://github.com/lpil)) + +- Fixed a bug where dependency version resolution could crash for certain + release candidate versions. + ([Marshall Bowers](https://github.com/maxdeviant)) diff --git a/Cargo.lock b/Cargo.lock index 9835e92b6..b5b9ed076 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -964,9 +964,9 @@ checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" [[package]] name = "hexpm" -version = "2.4.0" +version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37762aa95b4b16acae5732f51881d0384dca5f059d04b9a60089fc8019f43046" +checksum = "555eed2a876b665de8e13dca9ac08108b95d837ef3d7fe80205531e42eaf594b" dependencies = [ "base16", "bytes", From 9f595504ca1d3be4efc8681421581048bceccc65 Mon Sep 17 00:00:00 2001 From: Giacomo Cavalieri Date: Sat, 25 May 2024 17:18:51 +0200 Subject: [PATCH 5/8] fix 3190 --- CHANGELOG.md | 3 +++ compiler-core/src/format.rs | 28 ++++++++++++++++++++++------ compiler-core/src/format/tests.rs | 14 ++++++++++++++ 3 files changed, 39 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c019b71cb..57b4b1e33 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,3 +19,6 @@ - Fixed a bug where dependency version resolution could crash for certain release candidate versions. ([Marshall Bowers](https://github.com/maxdeviant)) + +- Fixed a bug where trailing comments would be moved out of a bit array. + ([Giacomo Cavalieri](https://github.com/giacomocavalieri)) diff --git a/compiler-core/src/format.rs b/compiler-core/src/format.rs index ec44125b5..d76b666a4 100644 --- a/compiler-core/src/format.rs +++ b/compiler-core/src/format.rs @@ -2277,13 +2277,16 @@ impl<'comments> Formatter<'comments> { is_simple: bool, location: &SrcSpan, ) -> Document<'a> { + let comments = self.pop_comments(location.end); + let comments_doc = printed_comments(comments, false); + // Avoid adding illegal comma in empty bit array by explicitly handling it if segments.is_empty() { // We take all comments that come _before_ the end of the bit array, // that is all comments that are inside "<<" and ">>", if there's // any comment we want to put it inside the empty bit array! // Refer to the `list` function for a similar procedure. - return match printed_comments(self.pop_comments(location.end), false) { + return match comments_doc { None => "<<>>".to_doc(), Some(comments) => "<<" .to_doc() @@ -2302,12 +2305,25 @@ impl<'comments> Formatter<'comments> { } else { break_(",", ", ") }; - break_("<<", "<<") + + let last_break = break_(",", ""); + let doc = break_("<<", "<<") .append(join(segments, comma)) - .nest(INDENT) - .append(break_(",", "")) - .append(">>") - .group() + .nest(INDENT); + + match comments_doc { + None => doc.append(last_break).append(">>").group(), + Some(comments) => doc + .append(last_break.nest(INDENT)) + // ^ Notice how in this case we nest the final break before + // adding it: this way the comments are going to be as + // indented as the bit array items. + .append(comments.nest(INDENT)) + .append(line()) + .append(">>") + .force_break() + .group(), + } } fn bit_array_segment_expr<'a>(&mut self, expr: &'a UntypedExpr) -> Document<'a> { diff --git a/compiler-core/src/format/tests.rs b/compiler-core/src/format/tests.rs index bdb121a6d..dafb2274c 100644 --- a/compiler-core/src/format/tests.rs +++ b/compiler-core/src/format/tests.rs @@ -6124,3 +6124,17 @@ fn multiline_comment_in_case_block() { "# ); } + +// https://github.com/gleam-lang/gleam/issues/3190 +#[test] +fn trailing_comments_inside_non_empty_bit_arrays_are_not_moved() { + assert_format!( + r#"pub fn main() { + << + 1, 2, + // One and two are above me. + >> +} +"# + ); +} From 49913b94c6c5cfbf0326a431f3a460b78d82e3ed Mon Sep 17 00:00:00 2001 From: Louis Pilfold Date: Thu, 30 May 2024 18:18:19 +0100 Subject: [PATCH 6/8] v1.2.1 --- CHANGELOG.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 57b4b1e33..45c8f933b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Gleam's Changelog -## Unreleased +## v1.3.0 - Unreleased ### Build tool @@ -12,6 +12,11 @@ ### Bug Fixes + +## v1.2.1 - 2024-05-30 + +### Bug Fixes + - Fixed a bug where the compiler could fail to detect modules that would clash with Erlang modules. ([Louis Pilfold](https://github.com/lpil)) From b0d7a1b9a4f02f8d9cf9edb4b7178f6420b30f53 Mon Sep 17 00:00:00 2001 From: PgBiel <9021226+PgBiel@users.noreply.github.com> Date: Sat, 8 Jun 2024 19:26:25 -0300 Subject: [PATCH 7/8] fix flake hash --- nix/glistix.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nix/glistix.nix b/nix/glistix.nix index 13807832c..d7cfbb73f 100644 --- a/nix/glistix.nix +++ b/nix/glistix.nix @@ -39,7 +39,7 @@ rustPlatform.buildRustPackage { buildInputs = [ openssl ] ++ lib.optionals stdenv.isDarwin [ Security SystemConfiguration ]; - cargoHash = "sha256-wIxMalEIHzVIX9aaSzsnvEEtSV51+i7bgl0qYBx1948="; + cargoHash = "sha256-Mn6UtLjcAEPGYUOckEVanagmxCEjlsLInykdD0bJ8OM="; meta = with lib; { description = "A fork of the Gleam compiler with a Nix backend"; From a6dd7a33259227475a4f8eca165af0792262e7cc Mon Sep 17 00:00:00 2001 From: PgBiel <9021226+PgBiel@users.noreply.github.com> Date: Sat, 8 Jun 2024 19:27:12 -0300 Subject: [PATCH 8/8] update gleam version constant --- compiler-core/src/version.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler-core/src/version.rs b/compiler-core/src/version.rs index d07cd9af4..b23cb2bb3 100644 --- a/compiler-core/src/version.rs +++ b/compiler-core/src/version.rs @@ -3,4 +3,4 @@ /// instead build from scratch /// Note that this should be updated to correspond to the Gleam version /// we are basing Glistix on. This is checked by packages. -pub const COMPILER_VERSION: &str = "1.1.0"; +pub const COMPILER_VERSION: &str = "1.2.1";