Fork of daniellemaywood.uk/gleam — Wasm codegen work
2

Configure Feed

Select the types of activity you want to include in your feed.

Initial work on package interface generation with cached modules

+1161 -251
+12 -1
compiler-cli/src/docs.rs
··· 1 1 use std::time::{Instant, SystemTime}; 2 2 3 3 use camino::{Utf8Path, Utf8PathBuf}; 4 + use ecow::EcoString; 4 5 5 6 use crate::{cli, fs::ProjectIO, http::HttpClient}; 6 7 use gleam_core::{ ··· 13 14 hex, 14 15 io::HttpClient as _, 15 16 paths::ProjectPaths, 17 + type_, 16 18 }; 17 19 18 20 pub fn remove(package: String, version: String) -> Result<()> { ··· 60 62 }, 61 63 crate::build::download_dependencies(paths, cli::Reporter::new())?, 62 64 )?; 63 - let outputs = build_documentation(paths, &config, &mut built.root_package, DocContext::Build)?; 65 + let outputs = build_documentation( 66 + paths, 67 + &config, 68 + &mut built.root_package, 69 + DocContext::Build, 70 + &built.module_interfaces, 71 + )?; 64 72 65 73 // Write 66 74 crate::fs::delete_directory(&out)?; ··· 100 108 config: &PackageConfig, 101 109 compiled: &mut Package, 102 110 is_hex_publish: DocContext, 111 + cached_modules: &im::HashMap<EcoString, type_::ModuleInterface>, 103 112 ) -> Result<Vec<gleam_core::io::OutputFile>, Error> { 104 113 compiled.attach_doc_and_module_comments(); 105 114 cli::print_generating_documentation(); ··· 122 131 outputs.push(gleam_core::docs::generate_json_package_interface( 123 132 Utf8PathBuf::from("package-interface.json"), 124 133 compiled, 134 + cached_modules, 125 135 )); 126 136 Ok(outputs) 127 137 } ··· 155 165 &config, 156 166 &mut built.root_package, 157 167 DocContext::HexPublish, 168 + &built.module_interfaces, 158 169 )?; 159 170 let archive = crate::fs::create_tar_archive(outputs)?; 160 171
+5 -1
compiler-cli/src/export.rs
··· 143 143 )?; 144 144 built.root_package.attach_doc_and_module_comments(); 145 145 146 - let out = gleam_core::docs::generate_json_package_interface(out, &built.root_package); 146 + let out = gleam_core::docs::generate_json_package_interface( 147 + out, 148 + &built.root_package, 149 + &built.module_interfaces, 150 + ); 147 151 crate::fs::write_outputs_under(&[out], paths.root())?; 148 152 Ok(()) 149 153 }
+6
compiler-cli/src/publish.rs
··· 1 1 use camino::{Utf8Path, Utf8PathBuf}; 2 + use ecow::EcoString; 2 3 use flate2::{Compression, write::GzEncoder}; 3 4 use gleam_core::{ 4 5 Error, Result, ··· 10 11 hex, 11 12 paths::{self, ProjectPaths}, 12 13 requirement::Requirement, 14 + type_, 13 15 }; 14 16 use hexpm::version::{Range, Version}; 15 17 use itertools::Itertools; ··· 32 34 33 35 let Tarball { 34 36 mut compile_result, 37 + cached_modules, 35 38 data: package_tarball, 36 39 src_files_added, 37 40 generated_files_added, ··· 46 49 &config, 47 50 &mut compile_result, 48 51 DocContext::HexPublish, 52 + &cached_modules, 49 53 )?)?; 50 54 51 55 // Ask user if this is correct ··· 256 260 257 261 struct Tarball { 258 262 compile_result: Package, 263 + cached_modules: im::HashMap<EcoString, type_::ModuleInterface>, 259 264 data: Vec<u8>, 260 265 src_files_added: Vec<Utf8PathBuf>, 261 266 generated_files_added: Vec<(Utf8PathBuf, String)>, ··· 372 377 tracing::info!("Generated package Hex release tarball"); 373 378 Ok(Tarball { 374 379 compile_result: built.root_package, 380 + cached_modules: built.module_interfaces, 375 381 data: tarball, 376 382 src_files_added: src_files, 377 383 generated_files_added: generated_files,
+693 -75
compiler-core/generated/schema_capnp.rs
··· 688 688 pub fn has_required_version(&self) -> bool { 689 689 !self.reader.get_pointer_field(8).is_null() 690 690 } 691 + #[inline] 692 + pub fn get_type_aliases(self) -> ::capnp::Result<::capnp::struct_list::Reader<'a,crate::schema_capnp::property::Owned<crate::schema_capnp::type_alias_constructor::Owned>>> { 693 + ::capnp::traits::FromPointerReader::get_from_pointer(&self.reader.get_pointer_field(9), ::core::option::Option::None) 694 + } 695 + #[inline] 696 + pub fn has_type_aliases(&self) -> bool { 697 + !self.reader.get_pointer_field(9).is_null() 698 + } 699 + #[inline] 700 + pub fn get_documentation(self) -> ::capnp::Result<::capnp::text_list::Reader<'a>> { 701 + ::capnp::traits::FromPointerReader::get_from_pointer(&self.reader.get_pointer_field(10), ::core::option::Option::None) 702 + } 703 + #[inline] 704 + pub fn has_documentation(&self) -> bool { 705 + !self.reader.get_pointer_field(10).is_null() 706 + } 691 707 } 692 708 693 709 pub struct Builder<'a> { builder: ::capnp::private::layout::StructBuilder<'a> } 694 710 impl <> ::capnp::traits::HasStructSize for Builder<'_,> { 695 - const STRUCT_SIZE: ::capnp::private::layout::StructSize = ::capnp::private::layout::StructSize { data: 1, pointers: 9 }; 711 + const STRUCT_SIZE: ::capnp::private::layout::StructSize = ::capnp::private::layout::StructSize { data: 1, pointers: 11 }; 696 712 } 697 713 impl <> ::capnp::traits::HasTypeId for Builder<'_,> { 698 714 const TYPE_ID: u64 = _private::TYPE_ID; ··· 894 910 pub fn has_required_version(&self) -> bool { 895 911 !self.builder.is_pointer_field_null(8) 896 912 } 913 + #[inline] 914 + pub fn get_type_aliases(self) -> ::capnp::Result<::capnp::struct_list::Builder<'a,crate::schema_capnp::property::Owned<crate::schema_capnp::type_alias_constructor::Owned>>> { 915 + ::capnp::traits::FromPointerBuilder::get_from_pointer(self.builder.get_pointer_field(9), ::core::option::Option::None) 916 + } 917 + #[inline] 918 + pub fn set_type_aliases(&mut self, value: ::capnp::struct_list::Reader<'_,crate::schema_capnp::property::Owned<crate::schema_capnp::type_alias_constructor::Owned>>) -> ::capnp::Result<()> { 919 + ::capnp::traits::SetterInput::set_pointer_builder(self.builder.reborrow().get_pointer_field(9), value, false) 920 + } 921 + #[inline] 922 + pub fn init_type_aliases(self, size: u32) -> ::capnp::struct_list::Builder<'a,crate::schema_capnp::property::Owned<crate::schema_capnp::type_alias_constructor::Owned>> { 923 + ::capnp::traits::FromPointerBuilder::init_pointer(self.builder.get_pointer_field(9), size) 924 + } 925 + #[inline] 926 + pub fn has_type_aliases(&self) -> bool { 927 + !self.builder.is_pointer_field_null(9) 928 + } 929 + #[inline] 930 + pub fn get_documentation(self) -> ::capnp::Result<::capnp::text_list::Builder<'a>> { 931 + ::capnp::traits::FromPointerBuilder::get_from_pointer(self.builder.get_pointer_field(10), ::core::option::Option::None) 932 + } 933 + #[inline] 934 + pub fn set_documentation(&mut self, value: impl ::capnp::traits::SetterInput<::capnp::text_list::Owned>) -> ::capnp::Result<()> { 935 + ::capnp::traits::SetterInput::set_pointer_builder(self.builder.reborrow().get_pointer_field(10), value, false) 936 + } 937 + #[inline] 938 + pub fn init_documentation(self, size: u32) -> ::capnp::text_list::Builder<'a> { 939 + ::capnp::traits::FromPointerBuilder::init_pointer(self.builder.get_pointer_field(10), size) 940 + } 941 + #[inline] 942 + pub fn has_documentation(&self) -> bool { 943 + !self.builder.is_pointer_field_null(10) 944 + } 897 945 } 898 946 899 947 pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline } ··· 911 959 } 912 960 } 913 961 mod _private { 914 - pub static ENCODED_NODE: [::capnp::Word; 237] = [ 962 + pub static ENCODED_NODE: [::capnp::Word; 289] = [ 915 963 ::capnp::word(0, 0, 0, 0, 5, 0, 6, 0), 916 964 ::capnp::word(129, 5, 219, 80, 68, 149, 82, 154), 917 965 ::capnp::word(13, 0, 0, 0, 1, 0, 1, 0), 918 966 ::capnp::word(190, 237, 188, 253, 156, 169, 51, 181), 919 - ::capnp::word(9, 0, 7, 0, 0, 0, 0, 0), 967 + ::capnp::word(11, 0, 7, 0, 0, 0, 0, 0), 920 968 ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 921 969 ::capnp::word(21, 0, 0, 0, 162, 0, 0, 0), 922 970 ::capnp::word(29, 0, 0, 0, 7, 0, 0, 0), 923 971 ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 924 - ::capnp::word(25, 0, 0, 0, 55, 2, 0, 0), 972 + ::capnp::word(25, 0, 0, 0, 167, 2, 0, 0), 925 973 ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 926 974 ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 927 975 ::capnp::word(115, 99, 104, 101, 109, 97, 46, 99), 928 976 ::capnp::word(97, 112, 110, 112, 58, 77, 111, 100), 929 977 ::capnp::word(117, 108, 101, 0, 0, 0, 0, 0), 930 978 ::capnp::word(0, 0, 0, 0, 1, 0, 1, 0), 931 - ::capnp::word(40, 0, 0, 0, 3, 0, 4, 0), 979 + ::capnp::word(48, 0, 0, 0, 3, 0, 4, 0), 932 980 ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 933 981 ::capnp::word(0, 0, 1, 0, 0, 0, 0, 0), 934 982 ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 935 - ::capnp::word(9, 1, 0, 0, 42, 0, 0, 0), 983 + ::capnp::word(65, 1, 0, 0, 42, 0, 0, 0), 936 984 ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 937 - ::capnp::word(4, 1, 0, 0, 3, 0, 1, 0), 938 - ::capnp::word(16, 1, 0, 0, 2, 0, 1, 0), 985 + ::capnp::word(60, 1, 0, 0, 3, 0, 1, 0), 986 + ::capnp::word(72, 1, 0, 0, 2, 0, 1, 0), 939 987 ::capnp::word(1, 0, 0, 0, 1, 0, 0, 0), 940 988 ::capnp::word(0, 0, 1, 0, 1, 0, 0, 0), 941 989 ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 942 - ::capnp::word(13, 1, 0, 0, 50, 0, 0, 0), 990 + ::capnp::word(69, 1, 0, 0, 50, 0, 0, 0), 943 991 ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 944 - ::capnp::word(8, 1, 0, 0, 3, 0, 1, 0), 945 - ::capnp::word(84, 1, 0, 0, 2, 0, 1, 0), 992 + ::capnp::word(64, 1, 0, 0, 3, 0, 1, 0), 993 + ::capnp::word(140, 1, 0, 0, 2, 0, 1, 0), 946 994 ::capnp::word(2, 0, 0, 0, 2, 0, 0, 0), 947 995 ::capnp::word(0, 0, 1, 0, 2, 0, 0, 0), 948 996 ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 949 - ::capnp::word(81, 1, 0, 0, 58, 0, 0, 0), 997 + ::capnp::word(137, 1, 0, 0, 58, 0, 0, 0), 950 998 ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 951 - ::capnp::word(76, 1, 0, 0, 3, 0, 1, 0), 952 - ::capnp::word(152, 1, 0, 0, 2, 0, 1, 0), 999 + ::capnp::word(132, 1, 0, 0, 3, 0, 1, 0), 1000 + ::capnp::word(208, 1, 0, 0, 2, 0, 1, 0), 953 1001 ::capnp::word(3, 0, 0, 0, 3, 0, 0, 0), 954 1002 ::capnp::word(0, 0, 1, 0, 3, 0, 0, 0), 955 1003 ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 956 - ::capnp::word(149, 1, 0, 0, 82, 0, 0, 0), 1004 + ::capnp::word(205, 1, 0, 0, 82, 0, 0, 0), 957 1005 ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 958 - ::capnp::word(148, 1, 0, 0, 3, 0, 1, 0), 959 - ::capnp::word(224, 1, 0, 0, 2, 0, 1, 0), 1006 + ::capnp::word(204, 1, 0, 0, 3, 0, 1, 0), 1007 + ::capnp::word(24, 2, 0, 0, 2, 0, 1, 0), 960 1008 ::capnp::word(4, 0, 0, 0, 4, 0, 0, 0), 961 1009 ::capnp::word(0, 0, 1, 0, 4, 0, 0, 0), 962 1010 ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 963 - ::capnp::word(221, 1, 0, 0, 66, 0, 0, 0), 1011 + ::capnp::word(21, 2, 0, 0, 66, 0, 0, 0), 964 1012 ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 965 - ::capnp::word(216, 1, 0, 0, 3, 0, 1, 0), 966 - ::capnp::word(228, 1, 0, 0, 2, 0, 1, 0), 1013 + ::capnp::word(16, 2, 0, 0, 3, 0, 1, 0), 1014 + ::capnp::word(28, 2, 0, 0, 2, 0, 1, 0), 967 1015 ::capnp::word(5, 0, 0, 0, 5, 0, 0, 0), 968 1016 ::capnp::word(0, 0, 1, 0, 5, 0, 0, 0), 969 1017 ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 970 - ::capnp::word(225, 1, 0, 0, 146, 0, 0, 0), 1018 + ::capnp::word(25, 2, 0, 0, 146, 0, 0, 0), 971 1019 ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 972 - ::capnp::word(228, 1, 0, 0, 3, 0, 1, 0), 973 - ::capnp::word(48, 2, 0, 0, 2, 0, 1, 0), 1020 + ::capnp::word(28, 2, 0, 0, 3, 0, 1, 0), 1021 + ::capnp::word(104, 2, 0, 0, 2, 0, 1, 0), 974 1022 ::capnp::word(6, 0, 0, 0, 6, 0, 0, 0), 975 1023 ::capnp::word(0, 0, 1, 0, 6, 0, 0, 0), 976 1024 ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 977 - ::capnp::word(45, 2, 0, 0, 98, 0, 0, 0), 1025 + ::capnp::word(101, 2, 0, 0, 98, 0, 0, 0), 978 1026 ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 979 - ::capnp::word(44, 2, 0, 0, 3, 0, 1, 0), 980 - ::capnp::word(56, 2, 0, 0, 2, 0, 1, 0), 1027 + ::capnp::word(100, 2, 0, 0, 3, 0, 1, 0), 1028 + ::capnp::word(112, 2, 0, 0, 2, 0, 1, 0), 981 1029 ::capnp::word(7, 0, 0, 0, 7, 0, 0, 0), 982 1030 ::capnp::word(0, 0, 1, 0, 7, 0, 0, 0), 983 1031 ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 984 - ::capnp::word(53, 2, 0, 0, 66, 0, 0, 0), 1032 + ::capnp::word(109, 2, 0, 0, 66, 0, 0, 0), 985 1033 ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 986 - ::capnp::word(48, 2, 0, 0, 3, 0, 1, 0), 987 - ::capnp::word(60, 2, 0, 0, 2, 0, 1, 0), 1034 + ::capnp::word(104, 2, 0, 0, 3, 0, 1, 0), 1035 + ::capnp::word(116, 2, 0, 0, 2, 0, 1, 0), 988 1036 ::capnp::word(8, 0, 0, 0, 0, 0, 0, 0), 989 1037 ::capnp::word(0, 0, 1, 0, 8, 0, 0, 0), 990 1038 ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 991 - ::capnp::word(57, 2, 0, 0, 90, 0, 0, 0), 1039 + ::capnp::word(113, 2, 0, 0, 90, 0, 0, 0), 992 1040 ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 993 - ::capnp::word(56, 2, 0, 0, 3, 0, 1, 0), 994 - ::capnp::word(68, 2, 0, 0, 2, 0, 1, 0), 1041 + ::capnp::word(112, 2, 0, 0, 3, 0, 1, 0), 1042 + ::capnp::word(124, 2, 0, 0, 2, 0, 1, 0), 995 1043 ::capnp::word(9, 0, 0, 0, 8, 0, 0, 0), 996 1044 ::capnp::word(0, 0, 1, 0, 9, 0, 0, 0), 997 1045 ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 998 - ::capnp::word(65, 2, 0, 0, 130, 0, 0, 0), 1046 + ::capnp::word(121, 2, 0, 0, 130, 0, 0, 0), 999 1047 ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 1000 - ::capnp::word(64, 2, 0, 0, 3, 0, 1, 0), 1001 - ::capnp::word(76, 2, 0, 0, 2, 0, 1, 0), 1048 + ::capnp::word(120, 2, 0, 0, 3, 0, 1, 0), 1049 + ::capnp::word(132, 2, 0, 0, 2, 0, 1, 0), 1050 + ::capnp::word(10, 0, 0, 0, 9, 0, 0, 0), 1051 + ::capnp::word(0, 0, 1, 0, 10, 0, 0, 0), 1052 + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 1053 + ::capnp::word(129, 2, 0, 0, 98, 0, 0, 0), 1054 + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 1055 + ::capnp::word(128, 2, 0, 0, 3, 0, 1, 0), 1056 + ::capnp::word(204, 2, 0, 0, 2, 0, 1, 0), 1057 + ::capnp::word(11, 0, 0, 0, 10, 0, 0, 0), 1058 + ::capnp::word(0, 0, 1, 0, 11, 0, 0, 0), 1059 + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 1060 + ::capnp::word(201, 2, 0, 0, 114, 0, 0, 0), 1061 + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 1062 + ::capnp::word(200, 2, 0, 0, 3, 0, 1, 0), 1063 + ::capnp::word(228, 2, 0, 0, 2, 0, 1, 0), 1002 1064 ::capnp::word(110, 97, 109, 101, 0, 0, 0, 0), 1003 1065 ::capnp::word(12, 0, 0, 0, 0, 0, 0, 0), 1004 1066 ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), ··· 1149 1211 ::capnp::word(16, 0, 0, 0, 0, 0, 0, 0), 1150 1212 ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 1151 1213 ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 1214 + ::capnp::word(116, 121, 112, 101, 65, 108, 105, 97), 1215 + ::capnp::word(115, 101, 115, 0, 0, 0, 0, 0), 1216 + ::capnp::word(14, 0, 0, 0, 0, 0, 0, 0), 1217 + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 1218 + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 1219 + ::capnp::word(0, 0, 0, 0, 3, 0, 1, 0), 1220 + ::capnp::word(16, 0, 0, 0, 0, 0, 0, 0), 1221 + ::capnp::word(106, 29, 126, 201, 93, 118, 154, 200), 1222 + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 1223 + ::capnp::word(0, 0, 0, 0, 0, 0, 1, 0), 1224 + ::capnp::word(1, 0, 0, 0, 31, 0, 0, 0), 1225 + ::capnp::word(4, 0, 0, 0, 2, 0, 1, 0), 1226 + ::capnp::word(106, 29, 126, 201, 93, 118, 154, 200), 1227 + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 1228 + ::capnp::word(1, 0, 0, 0, 23, 0, 0, 0), 1229 + ::capnp::word(4, 0, 0, 0, 1, 0, 1, 0), 1230 + ::capnp::word(1, 0, 0, 0, 0, 0, 0, 0), 1231 + ::capnp::word(0, 0, 0, 0, 3, 0, 1, 0), 1232 + ::capnp::word(16, 0, 0, 0, 0, 0, 0, 0), 1233 + ::capnp::word(77, 68, 194, 176, 34, 71, 88, 172), 1234 + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 1235 + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 1236 + ::capnp::word(14, 0, 0, 0, 0, 0, 0, 0), 1237 + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 1238 + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 1239 + ::capnp::word(100, 111, 99, 117, 109, 101, 110, 116), 1240 + ::capnp::word(97, 116, 105, 111, 110, 0, 0, 0), 1241 + ::capnp::word(14, 0, 0, 0, 0, 0, 0, 0), 1242 + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 1243 + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 1244 + ::capnp::word(0, 0, 0, 0, 3, 0, 1, 0), 1245 + ::capnp::word(12, 0, 0, 0, 0, 0, 0, 0), 1246 + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 1247 + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 1248 + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 1249 + ::capnp::word(14, 0, 0, 0, 0, 0, 0, 0), 1250 + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 1251 + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 1152 1252 ]; 1153 1253 pub fn get_field_types(index: u16) -> ::capnp::introspect::Type { 1154 1254 match index { ··· 1162 1262 7 => <::capnp::text::Owned as ::capnp::introspect::Introspect>::introspect(), 1163 1263 8 => <bool as ::capnp::introspect::Introspect>::introspect(), 1164 1264 9 => <crate::schema_capnp::version::Owned as ::capnp::introspect::Introspect>::introspect(), 1265 + 10 => <::capnp::struct_list::Owned<crate::schema_capnp::property::Owned<crate::schema_capnp::type_alias_constructor::Owned>> as ::capnp::introspect::Introspect>::introspect(), 1266 + 11 => <::capnp::text_list::Owned as ::capnp::introspect::Introspect>::introspect(), 1165 1267 _ => panic!("invalid field index {}", index), 1166 1268 } 1167 1269 } ··· 1174 1276 members_by_discriminant: MEMBERS_BY_DISCRIMINANT, 1175 1277 members_by_name: MEMBERS_BY_NAME, 1176 1278 }; 1177 - pub static NONUNION_MEMBERS : &[u16] = &[0,1,2,3,4,5,6,7,8,9]; 1279 + pub static NONUNION_MEMBERS : &[u16] = &[0,1,2,3,4,5,6,7,8,9,10,11]; 1178 1280 pub static MEMBERS_BY_DISCRIMINANT : &[u16] = &[]; 1179 - pub static MEMBERS_BY_NAME : &[u16] = &[3,8,6,0,4,9,7,1,5,2]; 1281 + pub static MEMBERS_BY_NAME : &[u16] = &[3,11,8,6,0,4,9,7,10,1,5,2]; 1180 1282 pub const TYPE_ID: u64 = 0x9a52_9544_50db_0581; 1181 1283 } 1182 1284 } 1183 1285 1286 + pub mod type_alias_constructor { 1287 + #[derive(Copy, Clone)] 1288 + pub struct Owned(()); 1289 + impl ::capnp::introspect::Introspect for Owned { fn introspect() -> ::capnp::introspect::Type { ::capnp::introspect::TypeVariant::Struct(::capnp::introspect::RawBrandedStructSchema { generic: &_private::RAW_SCHEMA, field_types: _private::get_field_types, annotation_types: _private::get_annotation_types }).into() } } 1290 + impl ::capnp::traits::Owned for Owned { type Reader<'a> = Reader<'a>; type Builder<'a> = Builder<'a>; } 1291 + impl ::capnp::traits::OwnedStruct for Owned { type Reader<'a> = Reader<'a>; type Builder<'a> = Builder<'a>; } 1292 + impl ::capnp::traits::Pipelined for Owned { type Pipeline = Pipeline; } 1293 + 1294 + pub struct Reader<'a> { reader: ::capnp::private::layout::StructReader<'a> } 1295 + impl <> ::core::marker::Copy for Reader<'_,> {} 1296 + impl <> ::core::clone::Clone for Reader<'_,> { 1297 + fn clone(&self) -> Self { *self } 1298 + } 1299 + 1300 + impl <> ::capnp::traits::HasTypeId for Reader<'_,> { 1301 + const TYPE_ID: u64 = _private::TYPE_ID; 1302 + } 1303 + impl <'a,> ::core::convert::From<::capnp::private::layout::StructReader<'a>> for Reader<'a,> { 1304 + fn from(reader: ::capnp::private::layout::StructReader<'a>) -> Self { 1305 + Self { reader, } 1306 + } 1307 + } 1308 + 1309 + impl <'a,> ::core::convert::From<Reader<'a,>> for ::capnp::dynamic_value::Reader<'a> { 1310 + fn from(reader: Reader<'a,>) -> Self { 1311 + Self::Struct(::capnp::dynamic_struct::Reader::new(reader.reader, ::capnp::schema::StructSchema::new(::capnp::introspect::RawBrandedStructSchema { generic: &_private::RAW_SCHEMA, field_types: _private::get_field_types::<>, annotation_types: _private::get_annotation_types::<>}))) 1312 + } 1313 + } 1314 + 1315 + impl <> ::core::fmt::Debug for Reader<'_,> { 1316 + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::result::Result<(), ::core::fmt::Error> { 1317 + core::fmt::Debug::fmt(&::core::convert::Into::<::capnp::dynamic_value::Reader<'_>>::into(*self), f) 1318 + } 1319 + } 1320 + 1321 + impl <'a,> ::capnp::traits::FromPointerReader<'a> for Reader<'a,> { 1322 + fn get_from_pointer(reader: &::capnp::private::layout::PointerReader<'a>, default: ::core::option::Option<&'a [::capnp::Word]>) -> ::capnp::Result<Self> { 1323 + ::core::result::Result::Ok(reader.get_struct(default)?.into()) 1324 + } 1325 + } 1326 + 1327 + impl <'a,> ::capnp::traits::IntoInternalStructReader<'a> for Reader<'a,> { 1328 + fn into_internal_struct_reader(self) -> ::capnp::private::layout::StructReader<'a> { 1329 + self.reader 1330 + } 1331 + } 1332 + 1333 + impl <'a,> ::capnp::traits::Imbue<'a> for Reader<'a,> { 1334 + fn imbue(&mut self, cap_table: &'a ::capnp::private::layout::CapTable) { 1335 + self.reader.imbue(::capnp::private::layout::CapTableReader::Plain(cap_table)) 1336 + } 1337 + } 1338 + 1339 + impl <'a,> Reader<'a,> { 1340 + pub fn reborrow(&self) -> Reader<'_,> { 1341 + Self { .. *self } 1342 + } 1343 + 1344 + pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { 1345 + self.reader.total_size() 1346 + } 1347 + #[inline] 1348 + pub fn get_publicity(self) -> ::capnp::Result<crate::schema_capnp::publicity::Reader<'a>> { 1349 + ::capnp::traits::FromPointerReader::get_from_pointer(&self.reader.get_pointer_field(0), ::core::option::Option::None) 1350 + } 1351 + #[inline] 1352 + pub fn has_publicity(&self) -> bool { 1353 + !self.reader.get_pointer_field(0).is_null() 1354 + } 1355 + #[inline] 1356 + pub fn get_module(self) -> ::capnp::Result<::capnp::text::Reader<'a>> { 1357 + ::capnp::traits::FromPointerReader::get_from_pointer(&self.reader.get_pointer_field(1), ::core::option::Option::None) 1358 + } 1359 + #[inline] 1360 + pub fn has_module(&self) -> bool { 1361 + !self.reader.get_pointer_field(1).is_null() 1362 + } 1363 + #[inline] 1364 + pub fn get_type(self) -> ::capnp::Result<crate::schema_capnp::type_::Reader<'a>> { 1365 + ::capnp::traits::FromPointerReader::get_from_pointer(&self.reader.get_pointer_field(2), ::core::option::Option::None) 1366 + } 1367 + #[inline] 1368 + pub fn has_type(&self) -> bool { 1369 + !self.reader.get_pointer_field(2).is_null() 1370 + } 1371 + #[inline] 1372 + pub fn get_arity(self) -> u32 { 1373 + self.reader.get_data_field::<u32>(0) 1374 + } 1375 + #[inline] 1376 + pub fn get_deprecation(self) -> ::capnp::Result<::capnp::text::Reader<'a>> { 1377 + ::capnp::traits::FromPointerReader::get_from_pointer(&self.reader.get_pointer_field(3), ::core::option::Option::None) 1378 + } 1379 + #[inline] 1380 + pub fn has_deprecation(&self) -> bool { 1381 + !self.reader.get_pointer_field(3).is_null() 1382 + } 1383 + #[inline] 1384 + pub fn get_documentation(self) -> ::capnp::Result<::capnp::text::Reader<'a>> { 1385 + ::capnp::traits::FromPointerReader::get_from_pointer(&self.reader.get_pointer_field(4), ::core::option::Option::None) 1386 + } 1387 + #[inline] 1388 + pub fn has_documentation(&self) -> bool { 1389 + !self.reader.get_pointer_field(4).is_null() 1390 + } 1391 + #[inline] 1392 + pub fn get_origin(self) -> ::capnp::Result<crate::schema_capnp::src_span::Reader<'a>> { 1393 + ::capnp::traits::FromPointerReader::get_from_pointer(&self.reader.get_pointer_field(5), ::core::option::Option::None) 1394 + } 1395 + #[inline] 1396 + pub fn has_origin(&self) -> bool { 1397 + !self.reader.get_pointer_field(5).is_null() 1398 + } 1399 + } 1400 + 1401 + pub struct Builder<'a> { builder: ::capnp::private::layout::StructBuilder<'a> } 1402 + impl <> ::capnp::traits::HasStructSize for Builder<'_,> { 1403 + const STRUCT_SIZE: ::capnp::private::layout::StructSize = ::capnp::private::layout::StructSize { data: 1, pointers: 6 }; 1404 + } 1405 + impl <> ::capnp::traits::HasTypeId for Builder<'_,> { 1406 + const TYPE_ID: u64 = _private::TYPE_ID; 1407 + } 1408 + impl <'a,> ::core::convert::From<::capnp::private::layout::StructBuilder<'a>> for Builder<'a,> { 1409 + fn from(builder: ::capnp::private::layout::StructBuilder<'a>) -> Self { 1410 + Self { builder, } 1411 + } 1412 + } 1413 + 1414 + impl <'a,> ::core::convert::From<Builder<'a,>> for ::capnp::dynamic_value::Builder<'a> { 1415 + fn from(builder: Builder<'a,>) -> Self { 1416 + Self::Struct(::capnp::dynamic_struct::Builder::new(builder.builder, ::capnp::schema::StructSchema::new(::capnp::introspect::RawBrandedStructSchema { generic: &_private::RAW_SCHEMA, field_types: _private::get_field_types::<>, annotation_types: _private::get_annotation_types::<>}))) 1417 + } 1418 + } 1419 + 1420 + impl <'a,> ::capnp::traits::ImbueMut<'a> for Builder<'a,> { 1421 + fn imbue_mut(&mut self, cap_table: &'a mut ::capnp::private::layout::CapTable) { 1422 + self.builder.imbue(::capnp::private::layout::CapTableBuilder::Plain(cap_table)) 1423 + } 1424 + } 1425 + 1426 + impl <'a,> ::capnp::traits::FromPointerBuilder<'a> for Builder<'a,> { 1427 + fn init_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, _size: u32) -> Self { 1428 + builder.init_struct(<Self as ::capnp::traits::HasStructSize>::STRUCT_SIZE).into() 1429 + } 1430 + fn get_from_pointer(builder: ::capnp::private::layout::PointerBuilder<'a>, default: ::core::option::Option<&'a [::capnp::Word]>) -> ::capnp::Result<Self> { 1431 + ::core::result::Result::Ok(builder.get_struct(<Self as ::capnp::traits::HasStructSize>::STRUCT_SIZE, default)?.into()) 1432 + } 1433 + } 1434 + 1435 + impl <> ::capnp::traits::SetterInput<Owned<>> for Reader<'_,> { 1436 + fn set_pointer_builder(mut pointer: ::capnp::private::layout::PointerBuilder<'_>, value: Self, canonicalize: bool) -> ::capnp::Result<()> { pointer.set_struct(&value.reader, canonicalize) } 1437 + } 1438 + 1439 + impl <'a,> Builder<'a,> { 1440 + pub fn into_reader(self) -> Reader<'a,> { 1441 + self.builder.into_reader().into() 1442 + } 1443 + pub fn reborrow(&mut self) -> Builder<'_,> { 1444 + Builder { builder: self.builder.reborrow() } 1445 + } 1446 + pub fn reborrow_as_reader(&self) -> Reader<'_,> { 1447 + self.builder.as_reader().into() 1448 + } 1449 + 1450 + pub fn total_size(&self) -> ::capnp::Result<::capnp::MessageSize> { 1451 + self.builder.as_reader().total_size() 1452 + } 1453 + #[inline] 1454 + pub fn get_publicity(self) -> ::capnp::Result<crate::schema_capnp::publicity::Builder<'a>> { 1455 + ::capnp::traits::FromPointerBuilder::get_from_pointer(self.builder.get_pointer_field(0), ::core::option::Option::None) 1456 + } 1457 + #[inline] 1458 + pub fn set_publicity(&mut self, value: crate::schema_capnp::publicity::Reader<'_>) -> ::capnp::Result<()> { 1459 + ::capnp::traits::SetterInput::set_pointer_builder(self.builder.reborrow().get_pointer_field(0), value, false) 1460 + } 1461 + #[inline] 1462 + pub fn init_publicity(self, ) -> crate::schema_capnp::publicity::Builder<'a> { 1463 + ::capnp::traits::FromPointerBuilder::init_pointer(self.builder.get_pointer_field(0), 0) 1464 + } 1465 + #[inline] 1466 + pub fn has_publicity(&self) -> bool { 1467 + !self.builder.is_pointer_field_null(0) 1468 + } 1469 + #[inline] 1470 + pub fn get_module(self) -> ::capnp::Result<::capnp::text::Builder<'a>> { 1471 + ::capnp::traits::FromPointerBuilder::get_from_pointer(self.builder.get_pointer_field(1), ::core::option::Option::None) 1472 + } 1473 + #[inline] 1474 + pub fn set_module(&mut self, value: impl ::capnp::traits::SetterInput<::capnp::text::Owned>) { 1475 + ::capnp::traits::SetterInput::set_pointer_builder(self.builder.reborrow().get_pointer_field(1), value, false).unwrap() 1476 + } 1477 + #[inline] 1478 + pub fn init_module(self, size: u32) -> ::capnp::text::Builder<'a> { 1479 + self.builder.get_pointer_field(1).init_text(size) 1480 + } 1481 + #[inline] 1482 + pub fn has_module(&self) -> bool { 1483 + !self.builder.is_pointer_field_null(1) 1484 + } 1485 + #[inline] 1486 + pub fn get_type(self) -> ::capnp::Result<crate::schema_capnp::type_::Builder<'a>> { 1487 + ::capnp::traits::FromPointerBuilder::get_from_pointer(self.builder.get_pointer_field(2), ::core::option::Option::None) 1488 + } 1489 + #[inline] 1490 + pub fn set_type(&mut self, value: crate::schema_capnp::type_::Reader<'_>) -> ::capnp::Result<()> { 1491 + ::capnp::traits::SetterInput::set_pointer_builder(self.builder.reborrow().get_pointer_field(2), value, false) 1492 + } 1493 + #[inline] 1494 + pub fn init_type(self, ) -> crate::schema_capnp::type_::Builder<'a> { 1495 + ::capnp::traits::FromPointerBuilder::init_pointer(self.builder.get_pointer_field(2), 0) 1496 + } 1497 + #[inline] 1498 + pub fn has_type(&self) -> bool { 1499 + !self.builder.is_pointer_field_null(2) 1500 + } 1501 + #[inline] 1502 + pub fn get_arity(self) -> u32 { 1503 + self.builder.get_data_field::<u32>(0) 1504 + } 1505 + #[inline] 1506 + pub fn set_arity(&mut self, value: u32) { 1507 + self.builder.set_data_field::<u32>(0, value); 1508 + } 1509 + #[inline] 1510 + pub fn get_deprecation(self) -> ::capnp::Result<::capnp::text::Builder<'a>> { 1511 + ::capnp::traits::FromPointerBuilder::get_from_pointer(self.builder.get_pointer_field(3), ::core::option::Option::None) 1512 + } 1513 + #[inline] 1514 + pub fn set_deprecation(&mut self, value: impl ::capnp::traits::SetterInput<::capnp::text::Owned>) { 1515 + ::capnp::traits::SetterInput::set_pointer_builder(self.builder.reborrow().get_pointer_field(3), value, false).unwrap() 1516 + } 1517 + #[inline] 1518 + pub fn init_deprecation(self, size: u32) -> ::capnp::text::Builder<'a> { 1519 + self.builder.get_pointer_field(3).init_text(size) 1520 + } 1521 + #[inline] 1522 + pub fn has_deprecation(&self) -> bool { 1523 + !self.builder.is_pointer_field_null(3) 1524 + } 1525 + #[inline] 1526 + pub fn get_documentation(self) -> ::capnp::Result<::capnp::text::Builder<'a>> { 1527 + ::capnp::traits::FromPointerBuilder::get_from_pointer(self.builder.get_pointer_field(4), ::core::option::Option::None) 1528 + } 1529 + #[inline] 1530 + pub fn set_documentation(&mut self, value: impl ::capnp::traits::SetterInput<::capnp::text::Owned>) { 1531 + ::capnp::traits::SetterInput::set_pointer_builder(self.builder.reborrow().get_pointer_field(4), value, false).unwrap() 1532 + } 1533 + #[inline] 1534 + pub fn init_documentation(self, size: u32) -> ::capnp::text::Builder<'a> { 1535 + self.builder.get_pointer_field(4).init_text(size) 1536 + } 1537 + #[inline] 1538 + pub fn has_documentation(&self) -> bool { 1539 + !self.builder.is_pointer_field_null(4) 1540 + } 1541 + #[inline] 1542 + pub fn get_origin(self) -> ::capnp::Result<crate::schema_capnp::src_span::Builder<'a>> { 1543 + ::capnp::traits::FromPointerBuilder::get_from_pointer(self.builder.get_pointer_field(5), ::core::option::Option::None) 1544 + } 1545 + #[inline] 1546 + pub fn set_origin(&mut self, value: crate::schema_capnp::src_span::Reader<'_>) -> ::capnp::Result<()> { 1547 + ::capnp::traits::SetterInput::set_pointer_builder(self.builder.reborrow().get_pointer_field(5), value, false) 1548 + } 1549 + #[inline] 1550 + pub fn init_origin(self, ) -> crate::schema_capnp::src_span::Builder<'a> { 1551 + ::capnp::traits::FromPointerBuilder::init_pointer(self.builder.get_pointer_field(5), 0) 1552 + } 1553 + #[inline] 1554 + pub fn has_origin(&self) -> bool { 1555 + !self.builder.is_pointer_field_null(5) 1556 + } 1557 + } 1558 + 1559 + pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline } 1560 + impl ::capnp::capability::FromTypelessPipeline for Pipeline { 1561 + fn new(typeless: ::capnp::any_pointer::Pipeline) -> Self { 1562 + Self { _typeless: typeless, } 1563 + } 1564 + } 1565 + impl Pipeline { 1566 + pub fn get_publicity(&self) -> crate::schema_capnp::publicity::Pipeline { 1567 + ::capnp::capability::FromTypelessPipeline::new(self._typeless.get_pointer_field(0)) 1568 + } 1569 + pub fn get_type(&self) -> crate::schema_capnp::type_::Pipeline { 1570 + ::capnp::capability::FromTypelessPipeline::new(self._typeless.get_pointer_field(2)) 1571 + } 1572 + pub fn get_origin(&self) -> crate::schema_capnp::src_span::Pipeline { 1573 + ::capnp::capability::FromTypelessPipeline::new(self._typeless.get_pointer_field(5)) 1574 + } 1575 + } 1576 + mod _private { 1577 + pub static ENCODED_NODE: [::capnp::Word; 127] = [ 1578 + ::capnp::word(0, 0, 0, 0, 5, 0, 6, 0), 1579 + ::capnp::word(77, 68, 194, 176, 34, 71, 88, 172), 1580 + ::capnp::word(13, 0, 0, 0, 1, 0, 1, 0), 1581 + ::capnp::word(190, 237, 188, 253, 156, 169, 51, 181), 1582 + ::capnp::word(6, 0, 7, 0, 0, 0, 0, 0), 1583 + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 1584 + ::capnp::word(21, 0, 0, 0, 18, 1, 0, 0), 1585 + ::capnp::word(37, 0, 0, 0, 7, 0, 0, 0), 1586 + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 1587 + ::capnp::word(33, 0, 0, 0, 143, 1, 0, 0), 1588 + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 1589 + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 1590 + ::capnp::word(115, 99, 104, 101, 109, 97, 46, 99), 1591 + ::capnp::word(97, 112, 110, 112, 58, 84, 121, 112), 1592 + ::capnp::word(101, 65, 108, 105, 97, 115, 67, 111), 1593 + ::capnp::word(110, 115, 116, 114, 117, 99, 116, 111), 1594 + ::capnp::word(114, 0, 0, 0, 0, 0, 0, 0), 1595 + ::capnp::word(0, 0, 0, 0, 1, 0, 1, 0), 1596 + ::capnp::word(28, 0, 0, 0, 3, 0, 4, 0), 1597 + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 1598 + ::capnp::word(0, 0, 1, 0, 0, 0, 0, 0), 1599 + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 1600 + ::capnp::word(181, 0, 0, 0, 82, 0, 0, 0), 1601 + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 1602 + ::capnp::word(180, 0, 0, 0, 3, 0, 1, 0), 1603 + ::capnp::word(192, 0, 0, 0, 2, 0, 1, 0), 1604 + ::capnp::word(1, 0, 0, 0, 1, 0, 0, 0), 1605 + ::capnp::word(0, 0, 1, 0, 1, 0, 0, 0), 1606 + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 1607 + ::capnp::word(189, 0, 0, 0, 58, 0, 0, 0), 1608 + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 1609 + ::capnp::word(184, 0, 0, 0, 3, 0, 1, 0), 1610 + ::capnp::word(196, 0, 0, 0, 2, 0, 1, 0), 1611 + ::capnp::word(2, 0, 0, 0, 2, 0, 0, 0), 1612 + ::capnp::word(0, 0, 1, 0, 2, 0, 0, 0), 1613 + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 1614 + ::capnp::word(193, 0, 0, 0, 42, 0, 0, 0), 1615 + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 1616 + ::capnp::word(188, 0, 0, 0, 3, 0, 1, 0), 1617 + ::capnp::word(200, 0, 0, 0, 2, 0, 1, 0), 1618 + ::capnp::word(3, 0, 0, 0, 0, 0, 0, 0), 1619 + ::capnp::word(0, 0, 1, 0, 3, 0, 0, 0), 1620 + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 1621 + ::capnp::word(197, 0, 0, 0, 50, 0, 0, 0), 1622 + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 1623 + ::capnp::word(192, 0, 0, 0, 3, 0, 1, 0), 1624 + ::capnp::word(204, 0, 0, 0, 2, 0, 1, 0), 1625 + ::capnp::word(4, 0, 0, 0, 3, 0, 0, 0), 1626 + ::capnp::word(0, 0, 1, 0, 4, 0, 0, 0), 1627 + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 1628 + ::capnp::word(201, 0, 0, 0, 98, 0, 0, 0), 1629 + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 1630 + ::capnp::word(200, 0, 0, 0, 3, 0, 1, 0), 1631 + ::capnp::word(212, 0, 0, 0, 2, 0, 1, 0), 1632 + ::capnp::word(5, 0, 0, 0, 4, 0, 0, 0), 1633 + ::capnp::word(0, 0, 1, 0, 5, 0, 0, 0), 1634 + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 1635 + ::capnp::word(209, 0, 0, 0, 114, 0, 0, 0), 1636 + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 1637 + ::capnp::word(208, 0, 0, 0, 3, 0, 1, 0), 1638 + ::capnp::word(220, 0, 0, 0, 2, 0, 1, 0), 1639 + ::capnp::word(6, 0, 0, 0, 5, 0, 0, 0), 1640 + ::capnp::word(0, 0, 1, 0, 6, 0, 0, 0), 1641 + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 1642 + ::capnp::word(217, 0, 0, 0, 58, 0, 0, 0), 1643 + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 1644 + ::capnp::word(212, 0, 0, 0, 3, 0, 1, 0), 1645 + ::capnp::word(224, 0, 0, 0, 2, 0, 1, 0), 1646 + ::capnp::word(112, 117, 98, 108, 105, 99, 105, 116), 1647 + ::capnp::word(121, 0, 0, 0, 0, 0, 0, 0), 1648 + ::capnp::word(16, 0, 0, 0, 0, 0, 0, 0), 1649 + ::capnp::word(102, 28, 233, 33, 200, 211, 73, 197), 1650 + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 1651 + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 1652 + ::capnp::word(16, 0, 0, 0, 0, 0, 0, 0), 1653 + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 1654 + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 1655 + ::capnp::word(109, 111, 100, 117, 108, 101, 0, 0), 1656 + ::capnp::word(12, 0, 0, 0, 0, 0, 0, 0), 1657 + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 1658 + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 1659 + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 1660 + ::capnp::word(12, 0, 0, 0, 0, 0, 0, 0), 1661 + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 1662 + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 1663 + ::capnp::word(116, 121, 112, 101, 0, 0, 0, 0), 1664 + ::capnp::word(16, 0, 0, 0, 0, 0, 0, 0), 1665 + ::capnp::word(0, 7, 151, 64, 46, 128, 246, 130), 1666 + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 1667 + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 1668 + ::capnp::word(16, 0, 0, 0, 0, 0, 0, 0), 1669 + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 1670 + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 1671 + ::capnp::word(97, 114, 105, 116, 121, 0, 0, 0), 1672 + ::capnp::word(8, 0, 0, 0, 0, 0, 0, 0), 1673 + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 1674 + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 1675 + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 1676 + ::capnp::word(8, 0, 0, 0, 0, 0, 0, 0), 1677 + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 1678 + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 1679 + ::capnp::word(100, 101, 112, 114, 101, 99, 97, 116), 1680 + ::capnp::word(105, 111, 110, 0, 0, 0, 0, 0), 1681 + ::capnp::word(12, 0, 0, 0, 0, 0, 0, 0), 1682 + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 1683 + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 1684 + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 1685 + ::capnp::word(12, 0, 0, 0, 0, 0, 0, 0), 1686 + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 1687 + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 1688 + ::capnp::word(100, 111, 99, 117, 109, 101, 110, 116), 1689 + ::capnp::word(97, 116, 105, 111, 110, 0, 0, 0), 1690 + ::capnp::word(12, 0, 0, 0, 0, 0, 0, 0), 1691 + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 1692 + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 1693 + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 1694 + ::capnp::word(12, 0, 0, 0, 0, 0, 0, 0), 1695 + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 1696 + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 1697 + ::capnp::word(111, 114, 105, 103, 105, 110, 0, 0), 1698 + ::capnp::word(16, 0, 0, 0, 0, 0, 0, 0), 1699 + ::capnp::word(176, 122, 119, 83, 72, 147, 59, 230), 1700 + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 1701 + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 1702 + ::capnp::word(16, 0, 0, 0, 0, 0, 0, 0), 1703 + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 1704 + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 1705 + ]; 1706 + pub fn get_field_types(index: u16) -> ::capnp::introspect::Type { 1707 + match index { 1708 + 0 => <crate::schema_capnp::publicity::Owned as ::capnp::introspect::Introspect>::introspect(), 1709 + 1 => <::capnp::text::Owned as ::capnp::introspect::Introspect>::introspect(), 1710 + 2 => <crate::schema_capnp::type_::Owned as ::capnp::introspect::Introspect>::introspect(), 1711 + 3 => <u32 as ::capnp::introspect::Introspect>::introspect(), 1712 + 4 => <::capnp::text::Owned as ::capnp::introspect::Introspect>::introspect(), 1713 + 5 => <::capnp::text::Owned as ::capnp::introspect::Introspect>::introspect(), 1714 + 6 => <crate::schema_capnp::src_span::Owned as ::capnp::introspect::Introspect>::introspect(), 1715 + _ => panic!("invalid field index {}", index), 1716 + } 1717 + } 1718 + pub fn get_annotation_types(child_index: Option<u16>, index: u32) -> ::capnp::introspect::Type { 1719 + panic!("invalid annotation indices ({:?}, {}) ", child_index, index) 1720 + } 1721 + pub static RAW_SCHEMA: ::capnp::introspect::RawStructSchema = ::capnp::introspect::RawStructSchema { 1722 + encoded_node: &ENCODED_NODE, 1723 + nonunion_members: NONUNION_MEMBERS, 1724 + members_by_discriminant: MEMBERS_BY_DISCRIMINANT, 1725 + members_by_name: MEMBERS_BY_NAME, 1726 + }; 1727 + pub static NONUNION_MEMBERS : &[u16] = &[0,1,2,3,4,5,6]; 1728 + pub static MEMBERS_BY_DISCRIMINANT : &[u16] = &[]; 1729 + pub static MEMBERS_BY_NAME : &[u16] = &[3,4,5,1,6,0,2]; 1730 + pub const TYPE_ID: u64 = 0xac58_4722_b0c2_444d; 1731 + } 1732 + } 1733 + 1184 1734 pub mod version { 1185 1735 #[derive(Copy, Clone)] 1186 1736 pub struct Owned(()); ··· 2012 2562 pub fn has_type(&self) -> bool { 2013 2563 !self.reader.get_pointer_field(0).is_null() 2014 2564 } 2565 + #[inline] 2566 + pub fn get_label(self) -> ::capnp::Result<::capnp::text::Reader<'a>> { 2567 + ::capnp::traits::FromPointerReader::get_from_pointer(&self.reader.get_pointer_field(1), ::core::option::Option::None) 2568 + } 2569 + #[inline] 2570 + pub fn has_label(&self) -> bool { 2571 + !self.reader.get_pointer_field(1).is_null() 2572 + } 2015 2573 } 2016 2574 2017 2575 pub struct Builder<'a> { builder: ::capnp::private::layout::StructBuilder<'a> } 2018 2576 impl <> ::capnp::traits::HasStructSize for Builder<'_,> { 2019 - const STRUCT_SIZE: ::capnp::private::layout::StructSize = ::capnp::private::layout::StructSize { data: 0, pointers: 1 }; 2577 + const STRUCT_SIZE: ::capnp::private::layout::StructSize = ::capnp::private::layout::StructSize { data: 0, pointers: 2 }; 2020 2578 } 2021 2579 impl <> ::capnp::traits::HasTypeId for Builder<'_,> { 2022 2580 const TYPE_ID: u64 = _private::TYPE_ID; ··· 2082 2640 pub fn has_type(&self) -> bool { 2083 2641 !self.builder.is_pointer_field_null(0) 2084 2642 } 2643 + #[inline] 2644 + pub fn get_label(self) -> ::capnp::Result<::capnp::text::Builder<'a>> { 2645 + ::capnp::traits::FromPointerBuilder::get_from_pointer(self.builder.get_pointer_field(1), ::core::option::Option::None) 2646 + } 2647 + #[inline] 2648 + pub fn set_label(&mut self, value: impl ::capnp::traits::SetterInput<::capnp::text::Owned>) { 2649 + ::capnp::traits::SetterInput::set_pointer_builder(self.builder.reborrow().get_pointer_field(1), value, false).unwrap() 2650 + } 2651 + #[inline] 2652 + pub fn init_label(self, size: u32) -> ::capnp::text::Builder<'a> { 2653 + self.builder.get_pointer_field(1).init_text(size) 2654 + } 2655 + #[inline] 2656 + pub fn has_label(&self) -> bool { 2657 + !self.builder.is_pointer_field_null(1) 2658 + } 2085 2659 } 2086 2660 2087 2661 pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline } ··· 2096 2670 } 2097 2671 } 2098 2672 mod _private { 2099 - pub static ENCODED_NODE: [::capnp::Word; 35] = [ 2673 + pub static ENCODED_NODE: [::capnp::Word; 50] = [ 2100 2674 ::capnp::word(0, 0, 0, 0, 5, 0, 6, 0), 2101 2675 ::capnp::word(234, 83, 193, 19, 176, 48, 149, 161), 2102 2676 ::capnp::word(13, 0, 0, 0, 1, 0, 0, 0), 2103 2677 ::capnp::word(190, 237, 188, 253, 156, 169, 51, 181), 2104 - ::capnp::word(1, 0, 7, 0, 0, 0, 0, 0), 2678 + ::capnp::word(2, 0, 7, 0, 0, 0, 0, 0), 2105 2679 ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 2106 2680 ::capnp::word(21, 0, 0, 0, 90, 1, 0, 0), 2107 2681 ::capnp::word(41, 0, 0, 0, 7, 0, 0, 0), 2108 2682 ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 2109 - ::capnp::word(37, 0, 0, 0, 63, 0, 0, 0), 2683 + ::capnp::word(37, 0, 0, 0, 119, 0, 0, 0), 2110 2684 ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 2111 2685 ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 2112 2686 ::capnp::word(115, 99, 104, 101, 109, 97, 46, 99), ··· 2116 2690 ::capnp::word(114, 80, 97, 114, 97, 109, 101, 116), 2117 2691 ::capnp::word(101, 114, 0, 0, 0, 0, 0, 0), 2118 2692 ::capnp::word(0, 0, 0, 0, 1, 0, 1, 0), 2119 - ::capnp::word(4, 0, 0, 0, 3, 0, 4, 0), 2693 + ::capnp::word(8, 0, 0, 0, 3, 0, 4, 0), 2120 2694 ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 2121 2695 ::capnp::word(0, 0, 1, 0, 0, 0, 0, 0), 2122 2696 ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 2123 - ::capnp::word(13, 0, 0, 0, 42, 0, 0, 0), 2697 + ::capnp::word(41, 0, 0, 0, 42, 0, 0, 0), 2124 2698 ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 2125 - ::capnp::word(8, 0, 0, 0, 3, 0, 1, 0), 2126 - ::capnp::word(20, 0, 0, 0, 2, 0, 1, 0), 2699 + ::capnp::word(36, 0, 0, 0, 3, 0, 1, 0), 2700 + ::capnp::word(48, 0, 0, 0, 2, 0, 1, 0), 2701 + ::capnp::word(1, 0, 0, 0, 1, 0, 0, 0), 2702 + ::capnp::word(0, 0, 1, 0, 1, 0, 0, 0), 2703 + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 2704 + ::capnp::word(45, 0, 0, 0, 50, 0, 0, 0), 2705 + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 2706 + ::capnp::word(40, 0, 0, 0, 3, 0, 1, 0), 2707 + ::capnp::word(52, 0, 0, 0, 2, 0, 1, 0), 2127 2708 ::capnp::word(116, 121, 112, 101, 0, 0, 0, 0), 2128 2709 ::capnp::word(16, 0, 0, 0, 0, 0, 0, 0), 2129 2710 ::capnp::word(0, 7, 151, 64, 46, 128, 246, 130), ··· 2132 2713 ::capnp::word(16, 0, 0, 0, 0, 0, 0, 0), 2133 2714 ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 2134 2715 ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 2716 + ::capnp::word(108, 97, 98, 101, 108, 0, 0, 0), 2717 + ::capnp::word(12, 0, 0, 0, 0, 0, 0, 0), 2718 + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 2719 + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 2720 + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 2721 + ::capnp::word(12, 0, 0, 0, 0, 0, 0, 0), 2722 + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 2723 + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 2135 2724 ]; 2136 2725 pub fn get_field_types(index: u16) -> ::capnp::introspect::Type { 2137 2726 match index { 2138 2727 0 => <crate::schema_capnp::type_::Owned as ::capnp::introspect::Introspect>::introspect(), 2728 + 1 => <::capnp::text::Owned as ::capnp::introspect::Introspect>::introspect(), 2139 2729 _ => panic!("invalid field index {}", index), 2140 2730 } 2141 2731 } ··· 2148 2738 members_by_discriminant: MEMBERS_BY_DISCRIMINANT, 2149 2739 members_by_name: MEMBERS_BY_NAME, 2150 2740 }; 2151 - pub static NONUNION_MEMBERS : &[u16] = &[0]; 2741 + pub static NONUNION_MEMBERS : &[u16] = &[0,1]; 2152 2742 pub static MEMBERS_BY_DISCRIMINANT : &[u16] = &[]; 2153 - pub static MEMBERS_BY_NAME : &[u16] = &[0]; 2743 + pub static MEMBERS_BY_NAME : &[u16] = &[1,0]; 2154 2744 pub const TYPE_ID: u64 = 0xa195_30b0_13c1_53ea; 2155 2745 } 2156 2746 } ··· 2272 2862 pub fn has_documentation(&self) -> bool { 2273 2863 !self.reader.get_pointer_field(6).is_null() 2274 2864 } 2865 + #[inline] 2866 + pub fn get_opaque(self) -> bool { 2867 + self.reader.get_bool_field(0) 2868 + } 2275 2869 } 2276 2870 2277 2871 pub struct Builder<'a> { builder: ::capnp::private::layout::StructBuilder<'a> } 2278 2872 impl <> ::capnp::traits::HasStructSize for Builder<'_,> { 2279 - const STRUCT_SIZE: ::capnp::private::layout::StructSize = ::capnp::private::layout::StructSize { data: 0, pointers: 7 }; 2873 + const STRUCT_SIZE: ::capnp::private::layout::StructSize = ::capnp::private::layout::StructSize { data: 1, pointers: 7 }; 2280 2874 } 2281 2875 impl <> ::capnp::traits::HasTypeId for Builder<'_,> { 2282 2876 const TYPE_ID: u64 = _private::TYPE_ID; ··· 2438 3032 pub fn has_documentation(&self) -> bool { 2439 3033 !self.builder.is_pointer_field_null(6) 2440 3034 } 3035 + #[inline] 3036 + pub fn get_opaque(self) -> bool { 3037 + self.builder.get_bool_field(0) 3038 + } 3039 + #[inline] 3040 + pub fn set_opaque(&mut self, value: bool) { 3041 + self.builder.set_bool_field(0, value); 3042 + } 2441 3043 } 2442 3044 2443 3045 pub struct Pipeline { _typeless: ::capnp::any_pointer::Pipeline } ··· 2458 3060 } 2459 3061 } 2460 3062 mod _private { 2461 - pub static ENCODED_NODE: [::capnp::Word; 131] = [ 3063 + pub static ENCODED_NODE: [::capnp::Word; 146] = [ 2462 3064 ::capnp::word(0, 0, 0, 0, 5, 0, 6, 0), 2463 3065 ::capnp::word(122, 109, 11, 224, 98, 109, 251, 177), 2464 - ::capnp::word(13, 0, 0, 0, 1, 0, 0, 0), 3066 + ::capnp::word(13, 0, 0, 0, 1, 0, 1, 0), 2465 3067 ::capnp::word(190, 237, 188, 253, 156, 169, 51, 181), 2466 3068 ::capnp::word(7, 0, 7, 0, 0, 0, 0, 0), 2467 3069 ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 2468 3070 ::capnp::word(21, 0, 0, 0, 234, 0, 0, 0), 2469 3071 ::capnp::word(33, 0, 0, 0, 7, 0, 0, 0), 2470 3072 ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 2471 - ::capnp::word(29, 0, 0, 0, 143, 1, 0, 0), 3073 + ::capnp::word(29, 0, 0, 0, 199, 1, 0, 0), 2472 3074 ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 2473 3075 ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 2474 3076 ::capnp::word(115, 99, 104, 101, 109, 97, 46, 99), ··· 2476 3078 ::capnp::word(101, 67, 111, 110, 115, 116, 114, 117), 2477 3079 ::capnp::word(99, 116, 111, 114, 0, 0, 0, 0), 2478 3080 ::capnp::word(0, 0, 0, 0, 1, 0, 1, 0), 2479 - ::capnp::word(28, 0, 0, 0, 3, 0, 4, 0), 3081 + ::capnp::word(32, 0, 0, 0, 3, 0, 4, 0), 2480 3082 ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 2481 3083 ::capnp::word(0, 0, 1, 0, 0, 0, 0, 0), 2482 3084 ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 2483 - ::capnp::word(181, 0, 0, 0, 42, 0, 0, 0), 3085 + ::capnp::word(209, 0, 0, 0, 42, 0, 0, 0), 2484 3086 ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 2485 - ::capnp::word(176, 0, 0, 0, 3, 0, 1, 0), 2486 - ::capnp::word(188, 0, 0, 0, 2, 0, 1, 0), 3087 + ::capnp::word(204, 0, 0, 0, 3, 0, 1, 0), 3088 + ::capnp::word(216, 0, 0, 0, 2, 0, 1, 0), 2487 3089 ::capnp::word(1, 0, 0, 0, 1, 0, 0, 0), 2488 3090 ::capnp::word(0, 0, 1, 0, 1, 0, 0, 0), 2489 3091 ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 2490 - ::capnp::word(185, 0, 0, 0, 90, 0, 0, 0), 3092 + ::capnp::word(213, 0, 0, 0, 90, 0, 0, 0), 2491 3093 ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 2492 - ::capnp::word(184, 0, 0, 0, 3, 0, 1, 0), 2493 - ::capnp::word(212, 0, 0, 0, 2, 0, 1, 0), 3094 + ::capnp::word(212, 0, 0, 0, 3, 0, 1, 0), 3095 + ::capnp::word(240, 0, 0, 0, 2, 0, 1, 0), 2494 3096 ::capnp::word(2, 0, 0, 0, 2, 0, 0, 0), 2495 3097 ::capnp::word(0, 0, 1, 0, 2, 0, 0, 0), 2496 3098 ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 2497 - ::capnp::word(209, 0, 0, 0, 58, 0, 0, 0), 3099 + ::capnp::word(237, 0, 0, 0, 58, 0, 0, 0), 2498 3100 ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 2499 - ::capnp::word(204, 0, 0, 0, 3, 0, 1, 0), 2500 - ::capnp::word(216, 0, 0, 0, 2, 0, 1, 0), 3101 + ::capnp::word(232, 0, 0, 0, 3, 0, 1, 0), 3102 + ::capnp::word(244, 0, 0, 0, 2, 0, 1, 0), 2501 3103 ::capnp::word(3, 0, 0, 0, 3, 0, 0, 0), 2502 3104 ::capnp::word(0, 0, 1, 0, 3, 0, 0, 0), 2503 3105 ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 2504 - ::capnp::word(213, 0, 0, 0, 82, 0, 0, 0), 3106 + ::capnp::word(241, 0, 0, 0, 82, 0, 0, 0), 2505 3107 ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 2506 - ::capnp::word(212, 0, 0, 0, 3, 0, 1, 0), 2507 - ::capnp::word(224, 0, 0, 0, 2, 0, 1, 0), 3108 + ::capnp::word(240, 0, 0, 0, 3, 0, 1, 0), 3109 + ::capnp::word(252, 0, 0, 0, 2, 0, 1, 0), 2508 3110 ::capnp::word(4, 0, 0, 0, 4, 0, 0, 0), 2509 3111 ::capnp::word(0, 0, 1, 0, 4, 0, 0, 0), 2510 3112 ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 2511 - ::capnp::word(221, 0, 0, 0, 90, 0, 0, 0), 3113 + ::capnp::word(249, 0, 0, 0, 90, 0, 0, 0), 2512 3114 ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 2513 - ::capnp::word(220, 0, 0, 0, 3, 0, 1, 0), 2514 - ::capnp::word(232, 0, 0, 0, 2, 0, 1, 0), 3115 + ::capnp::word(248, 0, 0, 0, 3, 0, 1, 0), 3116 + ::capnp::word(4, 1, 0, 0, 2, 0, 1, 0), 2515 3117 ::capnp::word(5, 0, 0, 0, 5, 0, 0, 0), 2516 3118 ::capnp::word(0, 0, 1, 0, 5, 0, 0, 0), 2517 3119 ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 2518 - ::capnp::word(229, 0, 0, 0, 58, 0, 0, 0), 3120 + ::capnp::word(1, 1, 0, 0, 58, 0, 0, 0), 2519 3121 ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 2520 - ::capnp::word(224, 0, 0, 0, 3, 0, 1, 0), 2521 - ::capnp::word(236, 0, 0, 0, 2, 0, 1, 0), 3122 + ::capnp::word(252, 0, 0, 0, 3, 0, 1, 0), 3123 + ::capnp::word(8, 1, 0, 0, 2, 0, 1, 0), 2522 3124 ::capnp::word(6, 0, 0, 0, 6, 0, 0, 0), 2523 3125 ::capnp::word(0, 0, 1, 0, 6, 0, 0, 0), 2524 3126 ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 2525 - ::capnp::word(233, 0, 0, 0, 114, 0, 0, 0), 3127 + ::capnp::word(5, 1, 0, 0, 114, 0, 0, 0), 3128 + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 3129 + ::capnp::word(4, 1, 0, 0, 3, 0, 1, 0), 3130 + ::capnp::word(16, 1, 0, 0, 2, 0, 1, 0), 3131 + ::capnp::word(7, 0, 0, 0, 0, 0, 0, 0), 3132 + ::capnp::word(0, 0, 1, 0, 7, 0, 0, 0), 3133 + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 3134 + ::capnp::word(13, 1, 0, 0, 58, 0, 0, 0), 2526 3135 ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 2527 - ::capnp::word(232, 0, 0, 0, 3, 0, 1, 0), 2528 - ::capnp::word(244, 0, 0, 0, 2, 0, 1, 0), 3136 + ::capnp::word(8, 1, 0, 0, 3, 0, 1, 0), 3137 + ::capnp::word(20, 1, 0, 0, 2, 0, 1, 0), 2529 3138 ::capnp::word(116, 121, 112, 101, 0, 0, 0, 0), 2530 3139 ::capnp::word(16, 0, 0, 0, 0, 0, 0, 0), 2531 3140 ::capnp::word(0, 7, 151, 64, 46, 128, 246, 130), ··· 2590 3199 ::capnp::word(12, 0, 0, 0, 0, 0, 0, 0), 2591 3200 ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 2592 3201 ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 3202 + ::capnp::word(111, 112, 97, 113, 117, 101, 0, 0), 3203 + ::capnp::word(1, 0, 0, 0, 0, 0, 0, 0), 3204 + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 3205 + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 3206 + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 3207 + ::capnp::word(1, 0, 0, 0, 0, 0, 0, 0), 3208 + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 3209 + ::capnp::word(0, 0, 0, 0, 0, 0, 0, 0), 2593 3210 ]; 2594 3211 pub fn get_field_types(index: u16) -> ::capnp::introspect::Type { 2595 3212 match index { ··· 2600 3217 4 => <::capnp::text::Owned as ::capnp::introspect::Introspect>::introspect(), 2601 3218 5 => <crate::schema_capnp::src_span::Owned as ::capnp::introspect::Introspect>::introspect(), 2602 3219 6 => <::capnp::text::Owned as ::capnp::introspect::Introspect>::introspect(), 3220 + 7 => <bool as ::capnp::introspect::Introspect>::introspect(), 2603 3221 _ => panic!("invalid field index {}", index), 2604 3222 } 2605 3223 } ··· 2612 3230 members_by_discriminant: MEMBERS_BY_DISCRIMINANT, 2613 3231 members_by_name: MEMBERS_BY_NAME, 2614 3232 }; 2615 - pub static NONUNION_MEMBERS : &[u16] = &[0,1,2,3,4,5,6]; 3233 + pub static NONUNION_MEMBERS : &[u16] = &[0,1,2,3,4,5,6,7]; 2616 3234 pub static MEMBERS_BY_DISCRIMINANT : &[u16] = &[]; 2617 - pub static MEMBERS_BY_NAME : &[u16] = &[4,6,2,5,1,3,0]; 3235 + pub static MEMBERS_BY_NAME : &[u16] = &[4,6,2,7,5,1,3,0]; 2618 3236 pub const TYPE_ID: u64 = 0xb1fb_6d62_e00b_6d7a; 2619 3237 } 2620 3238 }
+14
compiler-core/schema.capnp
··· 30 30 srcPath @7 :Text; 31 31 isInternal @8 :Bool; 32 32 requiredVersion @9 :Version; 33 + typeAliases @10 :List(Property(TypeAliasConstructor)); 34 + documentation @11 :List(Text); 35 + } 36 + 37 + struct TypeAliasConstructor { 38 + publicity @0 :Publicity; 39 + module @1 :Text; 40 + type @2 :Type; 41 + arity @3 :UInt32; 42 + deprecation @4 :Text; 43 + documentation @5 :Text; 44 + origin @6 :SrcSpan; 33 45 } 34 46 35 47 struct Version { ··· 50 62 51 63 struct TypeValueConstructorParameter { 52 64 type @0 :Type; 65 + label @1 :Text; 53 66 } 54 67 55 68 struct TypeConstructor { ··· 63 76 deprecated @4 :Text; 64 77 origin @5 :SrcSpan; 65 78 documentation @6 :Text; 79 + opaque @7 :Bool; 66 80 } 67 81 68 82 struct AccessorsMap {
+27 -5
compiler-core/src/analyse.rs
··· 22 22 parse::SpannedString, 23 23 type_::{ 24 24 self, AccessorsMap, Deprecation, ModuleInterface, PatternConstructor, RecordAccessor, Type, 25 - TypeConstructor, TypeValueConstructor, TypeValueConstructorField, TypeVariantConstructors, 26 - ValueConstructor, ValueConstructorVariant, Warning, 25 + TypeAliasConstructor, TypeConstructor, TypeValueConstructor, TypeValueConstructorField, 26 + TypeVariantConstructors, ValueConstructor, ValueConstructorVariant, Warning, 27 27 environment::*, 28 28 error::{Error, FeatureKind, MissingAnnotation, Named, Problems, convert_unify_error}, 29 29 expression::{ExprTyper, FunctionDefinition, Implementations}, ··· 299 299 module_values: values, 300 300 accessors, 301 301 names: type_names, 302 + module_type_aliases: type_aliases, 302 303 .. 303 304 } = env; 304 305 ··· 318 319 } 319 320 320 321 let module = ast::Module { 321 - documentation, 322 + documentation: documentation.clone(), 322 323 name: self.module_name.clone(), 323 324 definitions: typed_statements, 324 325 type_info: ModuleInterface { ··· 334 335 src_path: self.src_path, 335 336 warnings, 336 337 minimum_required_version: self.minimum_required_version, 338 + type_aliases, 339 + documentation, 337 340 }, 338 341 names: type_names, 339 342 }; ··· 1006 1009 } 1007 1010 }; 1008 1011 1009 - fields.push(TypeValueConstructorField { type_: t.clone() }); 1012 + fields.push(TypeValueConstructorField { 1013 + type_: t.clone(), 1014 + label: label.as_ref().map(|(_location, label)| label.clone()), 1015 + }); 1010 1016 1011 1017 // Register the type for this parameter 1012 1018 args_types.push(t); ··· 1175 1181 publicity, 1176 1182 type_, 1177 1183 documentation: documentation.as_ref().map(|(_, doc)| doc.clone()), 1184 + opaque: *opaque, 1178 1185 }, 1179 1186 ) 1180 1187 .expect("name uniqueness checked above"); ··· 1229 1236 // in some fashion. 1230 1237 let mut hydrator = Hydrator::new(); 1231 1238 let parameters = self.make_type_vars(args, &mut hydrator, environment); 1239 + let arity = parameters.len(); 1232 1240 let tryblock = || { 1233 1241 hydrator.disallow_new_type_variables(); 1234 1242 let type_ = hydrator.type_from_ast(resolved_type, environment, &mut self.problems)?; ··· 1244 1252 origin: *location, 1245 1253 module: self.module_name.clone(), 1246 1254 parameters, 1255 + type_: type_.clone(), 1256 + deprecation: deprecation.clone(), 1257 + publicity: *publicity, 1258 + documentation: documentation.as_ref().map(|(_, doc)| doc.clone()), 1259 + opaque: false, 1260 + }, 1261 + )?; 1262 + 1263 + environment.insert_type_alias( 1264 + name.clone(), 1265 + TypeAliasConstructor { 1266 + origin: *location, 1267 + module: self.module_name.clone(), 1247 1268 type_, 1248 - deprecation: deprecation.clone(), 1249 1269 publicity: *publicity, 1270 + deprecation: deprecation.clone(), 1250 1271 documentation: documentation.as_ref().map(|(_, doc)| doc.clone()), 1272 + arity, 1251 1273 }, 1252 1274 )?; 1253 1275
+1
compiler-core/src/build.rs
··· 215 215 pub struct Package { 216 216 pub config: PackageConfig, 217 217 pub modules: Vec<Module>, 218 + pub module_names: Vec<EcoString>, 218 219 } 219 220 220 221 impl Package {
+24 -3
compiler-core/src/build/package_compiler.rs
··· 30 30 31 31 use super::{ErlangAppCodegenConfiguration, TargetCodegenConfiguration, Telemetry}; 32 32 33 + pub struct Compiled { 34 + pub modules: Vec<Module>, 35 + pub module_names: Vec<EcoString>, 36 + } 37 + 33 38 #[derive(Debug)] 34 39 pub struct PackageCompiler<'a, IO> { 35 40 pub io: IO, ··· 104 109 stale_modules: &mut StaleTracker, 105 110 incomplete_modules: &mut HashSet<EcoString>, 106 111 telemetry: &dyn Telemetry, 107 - ) -> Outcome<Vec<Module>, Error> { 112 + ) -> Outcome<Compiled, Error> { 108 113 let span = tracing::info_span!("compile", package = %self.config.name.as_str()); 109 114 let _enter = span.enter(); 110 115 ··· 145 150 Loaded::empty() 146 151 }; 147 152 153 + let mut module_names = Vec::new(); 154 + 148 155 // Load the cached modules that have previously been compiled 149 156 for module in loaded.cached.into_iter() { 150 157 // Emit any cached warnings. ··· 153 160 if let Err(e) = self.emit_warnings(warnings, &module) { 154 161 return e.into(); 155 162 } 163 + 164 + module_names.push(module.name.clone()); 156 165 157 166 // Register the cached module so its type information etc can be 158 167 // used for compiling futher modules. ··· 184 193 185 194 let mut modules = match outcome { 186 195 Outcome::Ok(modules) => modules, 187 - Outcome::PartialFailure(_, _) | Outcome::TotalFailure(_) => return outcome, 196 + Outcome::PartialFailure(modules, error) => { 197 + return Outcome::PartialFailure( 198 + Compiled { 199 + modules, 200 + module_names, 201 + }, 202 + error, 203 + ) 204 + } 205 + Outcome::TotalFailure(error) => return Outcome::TotalFailure(error), 188 206 }; 189 207 190 208 for mut module in modules.iter_mut() { ··· 201 219 return error.into(); 202 220 } 203 221 204 - Outcome::Ok(modules) 222 + Outcome::Ok(Compiled { 223 + modules, 224 + module_names, 225 + }) 205 226 } 206 227 207 228 fn compile_erlang_to_beam(
+2
compiler-core/src/build/package_loader/tests.rs
··· 61 61 src_path: Utf8PathBuf::from(format!("/src/{}.gleam", name)), 62 62 warnings: vec![], 63 63 minimum_required_version: Version::new(0, 1, 0), 64 + type_aliases: Default::default(), 65 + documentation: Default::default(), 64 66 }; 65 67 let path = Utf8Path::new("/artefact").join(format!("{name}.cache")); 66 68 fs.write_bytes(
+16 -5
compiler-core/src/build/project_compiler.rs
··· 36 36 }; 37 37 38 38 use super::{ 39 - Codegen, Compile, ErlangAppCodegenConfiguration, Outcome, elixir_libraries::ElixirLibraries, 40 - package_compiler::CachedWarnings, 39 + Codegen, Compile, ErlangAppCodegenConfiguration, Outcome, 40 + elixir_libraries::ElixirLibraries, 41 + package_compiler::{CachedWarnings, Compiled}, 41 42 }; 42 43 43 44 use camino::{Utf8Path, Utf8PathBuf}; ··· 68 69 #[derive(Debug)] 69 70 pub struct Built { 70 71 pub root_package: Package, 71 - module_interfaces: im::HashMap<EcoString, type_::ModuleInterface>, 72 + pub module_interfaces: im::HashMap<EcoString, type_::ModuleInterface>, 72 73 compiled_dependency_modules: Vec<Module>, 73 74 } 74 75 ··· 211 212 pub fn compile_root_package(&mut self) -> Outcome<Package, Error> { 212 213 let config = self.config.clone(); 213 214 self.compile_gleam_package(&config, true, self.paths.root().to_path_buf()) 214 - .map(|modules| Package { config, modules }) 215 + .map( 216 + |Compiled { 217 + modules, 218 + module_names, 219 + }| Package { 220 + config, 221 + modules, 222 + module_names, 223 + }, 224 + ) 215 225 } 216 226 217 227 /// Checks that version file found in the build directory matches the ··· 522 532 let config = PackageConfig::read(config_path, &self.io)?; 523 533 self.compile_gleam_package(&config, false, package_root) 524 534 .into_result() 535 + .map(|compiled| compiled.modules) 525 536 } 526 537 527 538 fn compile_gleam_package( ··· 529 540 config: &PackageConfig, 530 541 is_root: bool, 531 542 root_path: Utf8PathBuf, 532 - ) -> Outcome<Vec<Module>, Error> { 543 + ) -> Outcome<Compiled, Error> { 533 544 let out_path = 534 545 self.paths 535 546 .build_directory_for_package(self.mode(), self.target(), &config.name);
+7 -3
compiler-core/src/docs.rs
··· 18 18 package_interface::PackageInterface, 19 19 paths::ProjectPaths, 20 20 pretty, 21 - type_::Deprecation, 21 + type_::{self, Deprecation}, 22 22 version::COMPILER_VERSION, 23 23 }; 24 24 use askama::Template; ··· 465 465 files 466 466 } 467 467 468 - pub fn generate_json_package_interface(path: Utf8PathBuf, package: &Package) -> OutputFile { 468 + pub fn generate_json_package_interface( 469 + path: Utf8PathBuf, 470 + package: &Package, 471 + cached_modules: &im::HashMap<EcoString, type_::ModuleInterface>, 472 + ) -> OutputFile { 469 473 OutputFile { 470 474 path, 471 475 content: Content::Text( 472 - serde_json::to_string(&PackageInterface::from_package(package)) 476 + serde_json::to_string(&PackageInterface::from_package(package, cached_modules)) 473 477 .expect("JSON module interface serialisation"), 474 478 ), 475 479 }
+2 -1
compiler-core/src/docs/tests.rs
··· 69 69 &mut HashSet::new(), 70 70 &NullTelemetry, 71 71 ) 72 - .unwrap(); 72 + .unwrap() 73 + .modules; 73 74 74 75 for module in &mut modules { 75 76 module.attach_doc_and_module_comments();
+1
compiler-core/src/exhaustiveness.rs
··· 994 994 .iter() 995 995 .map(|p| TypeValueConstructorField { 996 996 type_: self.specialise_type(p.type_.as_ref()), 997 + label: p.label.clone(), 997 998 }) 998 999 .collect_vec(); 999 1000 TypeValueConstructor {
+41 -4
compiler-core/src/metadata/module_decoder.rs
··· 1 1 #![allow(clippy::unnecessary_wraps)] // Needed for macro 2 2 3 - use capnp::text; 3 + use capnp::{text, text_list}; 4 4 use ecow::EcoString; 5 5 use itertools::Itertools; 6 6 ··· 15 15 schema_capnp::{self as schema, *}, 16 16 type_::{ 17 17 self, AccessorsMap, Deprecation, FieldMap, ModuleInterface, RecordAccessor, Type, 18 - TypeConstructor, TypeValueConstructor, TypeValueConstructorField, TypeVariantConstructors, 19 - ValueConstructor, ValueConstructorVariant, expression::Implementations, 18 + TypeAliasConstructor, TypeConstructor, TypeValueConstructor, TypeValueConstructorField, 19 + TypeVariantConstructors, ValueConstructor, ValueConstructorVariant, 20 + expression::Implementations, 20 21 }, 21 22 uid::UniqueIdGenerator, 22 23 }; ··· 83 84 src_path: self.str(reader.get_src_path()?)?.into(), 84 85 warnings: vec![], 85 86 minimum_required_version: self.version(&reader.get_required_version()?), 87 + type_aliases: read_hashmap!(reader.get_type_aliases()?, self, type_alias_constructor), 88 + documentation: self.string_list(reader.get_documentation()?)?, 86 89 }) 87 90 } 88 91 ··· 90 93 self.str(reader).map(|str| str.into()) 91 94 } 92 95 96 + fn string_list(&self, reader: text_list::Reader<'_>) -> Result<Vec<EcoString>> { 97 + let mut vec = Vec::with_capacity(reader.len() as usize); 98 + for reader in reader.into_iter() { 99 + vec.push(self.string(reader?)?); 100 + } 101 + Ok(vec) 102 + } 103 + 93 104 fn str<'a>(&self, reader: text::Reader<'a>) -> Result<&'a str> { 94 105 reader 95 106 .to_str() 96 - .map_err(|_| capnp::Error::failed("String contains non-utf8 charaters".into()).into()) 107 + .map_err(|_| capnp::Error::failed("String contains non-utf8 characters".into()).into()) 97 108 } 98 109 99 110 fn type_constructor( ··· 117 128 type_, 118 129 deprecation, 119 130 documentation: self.optional_string(self.str(reader.get_documentation()?)?), 131 + opaque: reader.get_opaque(), 132 + }) 133 + } 134 + 135 + fn type_alias_constructor( 136 + &mut self, 137 + reader: &type_alias_constructor::Reader<'_>, 138 + ) -> Result<TypeAliasConstructor> { 139 + let type_ = self.type_(&reader.get_type()?)?; 140 + let deprecation = reader.get_deprecation()?; 141 + let deprecation = if deprecation.is_empty() { 142 + Deprecation::NotDeprecated 143 + } else { 144 + Deprecation::Deprecated { 145 + message: self.string(deprecation)?, 146 + } 147 + }; 148 + Ok(TypeAliasConstructor { 149 + publicity: self.publicity(reader.get_publicity()?)?, 150 + origin: self.src_span(&reader.get_origin()?)?, 151 + module: self.string(reader.get_module()?)?, 152 + type_, 153 + deprecation, 154 + documentation: self.optional_string(self.str(reader.get_documentation()?)?), 155 + arity: reader.get_arity() as usize, 120 156 }) 121 157 } 122 158 ··· 219 255 ) -> Result<TypeValueConstructorField> { 220 256 Ok(TypeValueConstructorField { 221 257 type_: self.type_(&reader.get_type()?)?, 258 + label: self.optional_string(self.str(reader.get_label()?)?), 222 259 }) 223 260 } 224 261
+46 -4
compiler-core/src/metadata/module_encoder.rs
··· 7 7 }, 8 8 schema_capnp::{self as schema, *}, 9 9 type_::{ 10 - self, AccessorsMap, Deprecation, FieldMap, RecordAccessor, Type, TypeConstructor, 11 - TypeValueConstructor, TypeVar, TypeVariantConstructors, ValueConstructor, 10 + self, AccessorsMap, Deprecation, FieldMap, RecordAccessor, Type, TypeAliasConstructor, 11 + TypeConstructor, TypeValueConstructor, TypeVar, TypeVariantConstructors, ValueConstructor, 12 12 ValueConstructorVariant, expression::Implementations, 13 13 }, 14 14 }; ··· 48 48 self.set_module_types_constructors(&mut module); 49 49 self.set_line_numbers(&mut module); 50 50 self.set_version(&mut module); 51 + self.set_module_documentation(&mut module); 52 + self.set_module_type_aliases(&mut module); 51 53 52 54 capnp::serialize_packed::write_message(&mut buffer, &message).expect("capnp encode"); 53 55 Ok(buffer) ··· 63 65 } 64 66 } 65 67 68 + fn set_module_documentation(&mut self, module: &mut module::Builder<'_>) { 69 + let mut documentation = module 70 + .reborrow() 71 + .init_documentation(self.data.documentation.len() as u32); 72 + for (i, documentation_part) in self.data.documentation.iter().enumerate() { 73 + documentation.set(i as u32, documentation_part.as_str()); 74 + } 75 + } 76 + 66 77 fn set_module_accessors(&mut self, module: &mut module::Builder<'_>) { 67 78 let mut builder = module 68 79 .reborrow() ··· 129 140 } 130 141 } 131 142 143 + fn set_module_type_aliases(&mut self, module: &mut module::Builder<'_>) { 144 + let mut types = module 145 + .reborrow() 146 + .init_type_aliases(self.data.type_aliases.len() as u32); 147 + for (i, (name, alias)) in self.data.type_aliases.iter().enumerate() { 148 + let mut property = types.reborrow().get(i as u32); 149 + property.set_key(name); 150 + self.build_type_alias_constructor(property.init_value(), alias) 151 + } 152 + } 153 + 132 154 fn set_module_types_constructors(&mut self, module: &mut module::Builder<'_>) { 133 155 let mut types_constructors = module 134 156 .reborrow() ··· 203 225 .map(EcoString::as_str) 204 226 .unwrap_or_default(), 205 227 ); 228 + builder.set_opaque(constructor.opaque); 229 + } 230 + 231 + fn build_type_alias_constructor( 232 + &mut self, 233 + mut builder: type_alias_constructor::Builder<'_>, 234 + constructor: &TypeAliasConstructor, 235 + ) { 236 + builder.set_module(&constructor.module); 237 + builder.set_deprecation(match &constructor.deprecation { 238 + Deprecation::NotDeprecated => "", 239 + Deprecation::Deprecated { message } => message, 240 + }); 241 + self.build_publicity(builder.reborrow().init_publicity(), constructor.publicity); 242 + let type_builder = builder.reborrow().init_type(); 243 + self.build_type(type_builder, &constructor.type_); 244 + self.build_src_span(builder.reborrow().init_origin(), constructor.origin); 245 + builder.set_documentation(constructor.documentation.as_deref().unwrap_or_default()); 246 + builder.set_arity(constructor.arity as u32) 206 247 } 207 248 208 249 fn build_type_value_constructor( ··· 222 263 223 264 fn build_type_value_constructor_parameter( 224 265 &mut self, 225 - builder: type_value_constructor_parameter::Builder<'_>, 266 + mut builder: type_value_constructor_parameter::Builder<'_>, 226 267 parameter: &type_::TypeValueConstructorField, 227 268 ) { 228 - self.build_type(builder.init_type(), parameter.type_.as_ref()); 269 + self.build_type(builder.reborrow().init_type(), parameter.type_.as_ref()); 270 + builder.set_label(parameter.label.as_deref().unwrap_or_default()); 229 271 } 230 272 231 273 fn build_value_constructor(
+72
compiler-core/src/metadata/tests.rs
··· 64 64 line_numbers: LineNumbers::new(""), 65 65 src_path: "some_path".into(), 66 66 minimum_required_version: Version::new(0, 1, 0), 67 + type_aliases: HashMap::new(), 68 + documentation: Vec::new(), 67 69 } 68 70 } 69 71 ··· 98 100 line_numbers: LineNumbers::new(""), 99 101 src_path: "some_path".into(), 100 102 minimum_required_version: Version::new(0, 1, 0), 103 + type_aliases: HashMap::new(), 104 + documentation: Vec::new(), 101 105 }; 102 106 assert_eq!(roundtrip(&module), module); 103 107 } ··· 121 125 ), 122 126 src_path: "some_path".into(), 123 127 minimum_required_version: Version::new(0, 1, 0), 128 + type_aliases: HashMap::new(), 129 + documentation: Vec::new(), 124 130 }; 125 131 assert_eq!(roundtrip(&module), module); 126 132 } ··· 143 149 parameters: vec![], 144 150 deprecation: Deprecation::NotDeprecated, 145 151 documentation: None, 152 + opaque: false, 146 153 }, 147 154 )] 148 155 .into(), ··· 152 159 line_numbers: LineNumbers::new(""), 153 160 src_path: "some_path".into(), 154 161 minimum_required_version: Version::new(0, 1, 0), 162 + type_aliases: HashMap::new(), 163 + documentation: Vec::new(), 155 164 }; 156 165 assert_eq!(roundtrip(&module), module); 157 166 } ··· 174 183 parameters: vec![], 175 184 deprecation: Deprecation::NotDeprecated, 176 185 documentation: None, 186 + opaque: false, 177 187 }, 178 188 )] 179 189 .into(), ··· 183 193 line_numbers: LineNumbers::new(""), 184 194 src_path: "some_path".into(), 185 195 minimum_required_version: Version::new(0, 1, 0), 196 + type_aliases: HashMap::new(), 197 + documentation: Vec::new(), 186 198 }; 187 199 assert_eq!(roundtrip(&module), module); 188 200 } ··· 205 217 parameters: vec![], 206 218 deprecation: Deprecation::NotDeprecated, 207 219 documentation: None, 220 + opaque: false, 208 221 }, 209 222 )] 210 223 .into(), ··· 214 227 line_numbers: LineNumbers::new(""), 215 228 src_path: "some_path".into(), 216 229 minimum_required_version: Version::new(0, 1, 0), 230 + type_aliases: HashMap::new(), 231 + documentation: Vec::new(), 217 232 }; 218 233 assert_eq!(roundtrip(&module), module); 219 234 } ··· 236 251 parameters: vec![], 237 252 deprecation: Deprecation::NotDeprecated, 238 253 documentation: None, 254 + opaque: false, 239 255 }, 240 256 )] 241 257 .into(), ··· 245 261 line_numbers: LineNumbers::new(""), 246 262 src_path: "some_path".into(), 247 263 minimum_required_version: Version::new(0, 1, 0), 264 + type_aliases: HashMap::new(), 265 + documentation: Vec::new(), 248 266 }; 249 267 assert_eq!(roundtrip(&module), module); 250 268 } ··· 273 291 parameters: vec![t1, t2], 274 292 deprecation: Deprecation::NotDeprecated, 275 293 documentation: None, 294 + opaque: false, 276 295 }, 277 296 )] 278 297 .into(), ··· 282 301 line_numbers: LineNumbers::new(""), 283 302 src_path: "some_path".into(), 284 303 minimum_required_version: Version::new(0, 1, 0), 304 + type_aliases: HashMap::new(), 305 + documentation: Vec::new(), 285 306 } 286 307 } 287 308 ··· 310 331 parameters: vec![], 311 332 deprecation: Deprecation::NotDeprecated, 312 333 documentation: None, 334 + opaque: false, 313 335 }, 314 336 )] 315 337 .into(), ··· 319 341 line_numbers: LineNumbers::new(""), 320 342 src_path: "some_path".into(), 321 343 minimum_required_version: Version::new(0, 1, 0), 344 + type_aliases: HashMap::new(), 345 + documentation: Vec::new(), 322 346 } 323 347 } 324 348 ··· 347 371 parameters: vec![], 348 372 deprecation: Deprecation::NotDeprecated, 349 373 documentation: Some("type documentation".into()), 374 + opaque: false, 350 375 }, 351 376 )] 352 377 .into(), ··· 356 381 line_numbers: LineNumbers::new(""), 357 382 src_path: "some_path".into(), 358 383 minimum_required_version: Version::new(0, 1, 0), 384 + type_aliases: HashMap::new(), 385 + documentation: Vec::new(), 359 386 } 360 387 } 361 388 ··· 387 414 parameters: vec![], 388 415 deprecation: Deprecation::NotDeprecated, 389 416 documentation: None, 417 + opaque: false, 390 418 }, 391 419 )] 392 420 .into(), ··· 396 424 line_numbers: LineNumbers::new(""), 397 425 src_path: "some_path".into(), 398 426 minimum_required_version: Version::new(0, 1, 0), 427 + type_aliases: HashMap::new(), 428 + documentation: Vec::new(), 399 429 } 400 430 } 401 431 ··· 427 457 line_numbers: LineNumbers::new(""), 428 458 src_path: "some_path".into(), 429 459 minimum_required_version: Version::new(0, 1, 0), 460 + type_aliases: HashMap::new(), 461 + documentation: Vec::new(), 430 462 }; 431 463 432 464 assert_eq!(roundtrip(&module), module); ··· 475 507 line_numbers: LineNumbers::new(""), 476 508 src_path: "some_path".into(), 477 509 minimum_required_version: Version::new(0, 1, 0), 510 + type_aliases: HashMap::new(), 511 + documentation: Vec::new(), 478 512 }; 479 513 assert_eq!(roundtrip(&module), module); 480 514 } ··· 524 558 line_numbers: LineNumbers::new(""), 525 559 src_path: "some_path".into(), 526 560 minimum_required_version: Version::new(0, 1, 0), 561 + type_aliases: HashMap::new(), 562 + documentation: Vec::new(), 527 563 }; 528 564 assert_eq!(roundtrip(&module), module); 529 565 } ··· 571 607 line_numbers: LineNumbers::new(""), 572 608 src_path: "some_path".into(), 573 609 minimum_required_version: Version::new(0, 1, 0), 610 + type_aliases: HashMap::new(), 611 + documentation: Vec::new(), 574 612 }; 575 613 576 614 assert_eq!(roundtrip(&module), module); ··· 620 658 line_numbers: LineNumbers::new(""), 621 659 src_path: "some_path".into(), 622 660 minimum_required_version: Version::new(0, 1, 0), 661 + type_aliases: HashMap::new(), 662 + documentation: Vec::new(), 623 663 }; 624 664 625 665 assert_eq!(roundtrip(&module), module); ··· 668 708 line_numbers: LineNumbers::new(""), 669 709 src_path: "some_path".into(), 670 710 minimum_required_version: Version::new(0, 1, 0), 711 + type_aliases: HashMap::new(), 712 + documentation: Vec::new(), 671 713 }; 672 714 673 715 assert_eq!(roundtrip(&module), module); ··· 711 753 line_numbers: LineNumbers::new(""), 712 754 src_path: "some_path".into(), 713 755 minimum_required_version: Version::new(0, 1, 0), 756 + type_aliases: HashMap::new(), 757 + documentation: Vec::new(), 714 758 }; 715 759 716 760 assert_eq!(roundtrip(&module), module); ··· 758 802 line_numbers: LineNumbers::new(""), 759 803 src_path: "some_path".into(), 760 804 minimum_required_version: Version::new(0, 1, 0), 805 + type_aliases: HashMap::new(), 806 + documentation: Vec::new(), 761 807 }; 762 808 763 809 assert_eq!(roundtrip(&module), module); ··· 826 872 line_numbers: LineNumbers::new(""), 827 873 src_path: "some_path".into(), 828 874 minimum_required_version: Version::new(0, 1, 0), 875 + type_aliases: HashMap::new(), 876 + documentation: Vec::new(), 829 877 }; 830 878 831 879 assert_eq!(roundtrip(&module), module); ··· 894 942 line_numbers: LineNumbers::new(""), 895 943 src_path: "some_path".into(), 896 944 minimum_required_version: Version::new(0, 1, 0), 945 + type_aliases: HashMap::new(), 946 + documentation: Vec::new(), 897 947 }; 898 948 899 949 assert_eq!(roundtrip(&module), module); ··· 1116 1166 line_numbers: LineNumbers::new(""), 1117 1167 src_path: "some_path".into(), 1118 1168 minimum_required_version: Version::new(0, 1, 0), 1169 + type_aliases: HashMap::new(), 1170 + documentation: Vec::new(), 1119 1171 }; 1120 1172 1121 1173 assert_eq!(roundtrip(&module), module); ··· 1299 1351 message: "oh no".into(), 1300 1352 }, 1301 1353 documentation: None, 1354 + opaque: false, 1302 1355 }, 1303 1356 )] 1304 1357 .into(), ··· 1308 1361 line_numbers: LineNumbers::new(""), 1309 1362 src_path: "some_path".into(), 1310 1363 minimum_required_version: Version::new(0, 1, 0), 1364 + type_aliases: HashMap::new(), 1365 + documentation: Vec::new(), 1311 1366 }; 1312 1367 assert_eq!(roundtrip(&module), module); 1313 1368 } ··· 1355 1410 line_numbers: LineNumbers::new(""), 1356 1411 src_path: "some_path".into(), 1357 1412 minimum_required_version: Version::new(0, 1, 0), 1413 + type_aliases: HashMap::new(), 1414 + documentation: Vec::new(), 1358 1415 }; 1359 1416 1360 1417 assert_eq!(roundtrip(&module), module); ··· 1405 1462 line_numbers: LineNumbers::new(""), 1406 1463 src_path: "some_path".into(), 1407 1464 minimum_required_version: Version::new(0, 1, 0), 1465 + type_aliases: HashMap::new(), 1466 + documentation: Vec::new(), 1408 1467 }; 1409 1468 1410 1469 assert_eq!(roundtrip(&module), module); ··· 1458 1517 line_numbers: LineNumbers::new(""), 1459 1518 src_path: "some_path".into(), 1460 1519 minimum_required_version: Version::new(0, 1, 0), 1520 + type_aliases: HashMap::new(), 1521 + documentation: Vec::new(), 1461 1522 }; 1462 1523 1463 1524 assert_eq!(roundtrip(&module), module); ··· 1482 1543 parameters: vec![ 1483 1544 TypeValueConstructorField { 1484 1545 type_: type_::generic_var(6), 1546 + label: None, 1485 1547 }, 1486 1548 TypeValueConstructorField { 1487 1549 type_: type_::int(), 1550 + label: None, 1488 1551 }, 1489 1552 TypeValueConstructorField { 1490 1553 type_: type_::tuple(vec![type_::generic_var(4), type_::generic_var(5)]), 1554 + label: None, 1491 1555 }, 1492 1556 ], 1493 1557 }], ··· 1498 1562 line_numbers: LineNumbers::new(""), 1499 1563 src_path: "some_path".into(), 1500 1564 minimum_required_version: Version::new(0, 1, 0), 1565 + type_aliases: HashMap::new(), 1566 + documentation: Vec::new(), 1501 1567 }; 1502 1568 1503 1569 let expected = HashMap::from([( ··· 1509 1575 parameters: vec![ 1510 1576 TypeValueConstructorField { 1511 1577 type_: type_::generic_var(0), 1578 + label: None, 1512 1579 }, 1513 1580 TypeValueConstructorField { 1514 1581 type_: type_::int(), 1582 + label: None, 1515 1583 }, 1516 1584 TypeValueConstructorField { 1517 1585 type_: type_::tuple(vec![type_::generic_var(1), type_::generic_var(2)]), 1586 + label: None, 1518 1587 }, 1519 1588 ], 1520 1589 }], ··· 1549 1618 parameters: vec![], 1550 1619 deprecation: Deprecation::NotDeprecated, 1551 1620 documentation: None, 1621 + opaque: false, 1552 1622 }, 1553 1623 )] 1554 1624 .into(), ··· 1558 1628 line_numbers: LineNumbers::new(""), 1559 1629 src_path: "some_path".into(), 1560 1630 minimum_required_version: Version::new(0, 1, 0), 1631 + type_aliases: HashMap::new(), 1632 + documentation: Vec::new(), 1561 1633 }; 1562 1634 assert_eq!(roundtrip(&module), module); 1563 1635 }
+136 -146
compiler-core/src/package_interface.rs
··· 1 1 use std::{collections::HashMap, ops::Deref}; 2 2 3 3 use ecow::EcoString; 4 - use itertools::Itertools; 5 4 use serde::Serialize; 6 5 7 6 #[cfg(test)] 8 7 mod tests; 9 8 10 9 use crate::{ 11 - ast::{CustomType, Definition, Function, ModuleConstant, Publicity, TypeAlias}, 12 10 io::ordered_map, 13 - type_::{Deprecation, Type, TypeVar, expression::Implementations}, 11 + type_::{ 12 + self, Deprecation, Type, TypeConstructor, TypeVar, ValueConstructorVariant, 13 + expression::Implementations, 14 + }, 14 15 }; 15 16 16 - use crate::build::{Module, Package}; 17 + use crate::build::Package; 17 18 18 19 /// The public interface of a package that gets serialised as a json object. 19 20 #[derive(Serialize, Debug)] ··· 358 359 } 359 360 360 361 impl PackageInterface { 361 - pub fn from_package(package: &Package) -> PackageInterface { 362 + pub fn from_package( 363 + package: &Package, 364 + cached_modules: &im::HashMap<EcoString, type_::ModuleInterface>, 365 + ) -> PackageInterface { 362 366 PackageInterface { 363 367 name: package.config.name.clone(), 364 368 version: package.config.version.to_string().into(), ··· 370 374 modules: package 371 375 .modules 372 376 .iter() 377 + .map(|module| &module.ast.type_info) 378 + .chain( 379 + package 380 + .module_names 381 + .iter() 382 + .filter_map(|name| cached_modules.get(name)), 383 + ) 373 384 .filter(|module| !package.config.is_internal_module(module.name.as_str())) 374 - .map(|module| (module.name.clone(), ModuleInterface::from_module(module))) 385 + .map(|module| (module.name.clone(), ModuleInterface::from_interface(module))) 375 386 .collect(), 376 387 } 377 388 } 378 389 } 379 390 380 391 impl ModuleInterface { 381 - fn from_module(module: &Module) -> ModuleInterface { 392 + pub fn from_interface(interface: &type_::ModuleInterface) -> ModuleInterface { 382 393 let mut types = HashMap::new(); 383 394 let mut type_aliases = HashMap::new(); 384 395 let mut constants = HashMap::new(); 385 396 let mut functions = HashMap::new(); 386 - for statement in &module.ast.definitions { 387 - match statement { 388 - // A public type definition. 389 - Definition::CustomType(CustomType { 390 - publicity: Publicity::Public, 391 - name, 392 - constructors, 393 - documentation, 394 - opaque, 395 - deprecation, 396 - typed_parameters, 397 - parameters: _, 398 - location: _, 399 - name_location: _, 400 - end_position: _, 401 - }) => { 402 - let mut id_map = IdMap::new(); 397 + for (name, constructor) in interface 398 + .types 399 + .iter() 400 + .filter(|(_, c)| c.publicity.is_public()) 401 + { 402 + let mut id_map = IdMap::new(); 403 403 404 - // Let's first add all the types that appear in the type parameters so those are 405 - // taken into account when assigning incremental numbers to the constructor's 406 - // type variables. 407 - for typed_parameter in typed_parameters { 408 - id_map.add_type_variable_id(typed_parameter.as_ref()); 409 - } 404 + let TypeConstructor { 405 + deprecation, 406 + documentation, 407 + .. 408 + } = constructor; 410 409 411 - let _ = types.insert( 412 - name.clone(), 413 - TypeDefinitionInterface { 414 - documentation: documentation.as_ref().map(|(_, doc)| doc.clone()), 415 - deprecation: DeprecationInterface::from_deprecation(deprecation), 416 - parameters: typed_parameters.len(), 417 - constructors: if *opaque { 418 - vec![] 419 - } else { 420 - constructors 421 - .iter() 422 - .map(|constructor| TypeConstructorInterface { 423 - documentation: constructor 424 - .documentation 425 - .as_ref() 426 - .map(|(_, doc)| doc.clone()), 427 - name: constructor.name.clone(), 428 - parameters: constructor 429 - .arguments 430 - .iter() 431 - .map(|arg| ParameterInterface { 432 - label: arg 433 - .label 434 - .as_ref() 435 - .map(|(_, label)| label.clone()), 436 - // We share the same id_map between each step so that the 437 - // incremental ids assigned are consisten with each other 438 - type_: from_type_helper(&arg.type_, &mut id_map), 439 - }) 440 - .collect_vec(), 441 - }) 442 - .collect() 443 - }, 444 - }, 445 - ); 446 - } 410 + for typed_parameter in &constructor.parameters { 411 + id_map.add_type_variable_id(typed_parameter.as_ref()); 412 + } 447 413 448 - // A public type alias definition 449 - Definition::TypeAlias(TypeAlias { 450 - publicity: Publicity::Public, 451 - alias, 452 - parameters, 453 - type_, 454 - documentation, 455 - deprecation, 456 - location: _, 457 - name_location: _, 458 - type_ast: _, 459 - }) => { 460 - let _ = type_aliases.insert( 461 - alias.clone(), 462 - TypeAliasInterface { 463 - documentation: documentation.as_ref().map(|(_, doc)| doc.clone()), 464 - deprecation: DeprecationInterface::from_deprecation(deprecation), 465 - parameters: parameters.len(), 466 - alias: TypeInterface::from_type(type_.as_ref()), 467 - }, 468 - ); 469 - } 414 + let _ = types.insert( 415 + name.clone(), 416 + TypeDefinitionInterface { 417 + documentation: documentation.clone(), 418 + deprecation: DeprecationInterface::from_deprecation(&deprecation), 419 + parameters: interface 420 + .types 421 + .get(&name.clone()) 422 + .map_or(vec![], |t| t.parameters.clone()) 423 + .len(), 424 + constructors: if constructor.opaque { 425 + vec![] 426 + } else { 427 + match interface.types_value_constructors.get(&name.clone()) { 428 + Some(constructors) => constructors 429 + .variants 430 + .iter() 431 + .map(|constructor| TypeConstructorInterface { 432 + // TODO: Find documentation 433 + documentation: None, 434 + name: constructor.name.clone(), 435 + parameters: constructor 436 + .parameters 437 + .iter() 438 + .map(|arg| ParameterInterface { 439 + label: arg.label.clone(), 440 + // We share the same id_map between each step so that the 441 + // incremental ids assigned are consisten with each other 442 + type_: from_type_helper( 443 + arg.type_.as_ref(), 444 + &mut id_map, 445 + ), 446 + }) 447 + .collect(), 448 + }) 449 + .collect(), 450 + None => vec![], 451 + } 452 + }, 453 + }, 454 + ); 455 + } 470 456 471 - // A public module constant. 472 - Definition::ModuleConstant(ModuleConstant { 473 - publicity: Publicity::Public, 474 - name, 475 - type_, 476 - documentation, 477 - implementations, 478 - deprecation, 479 - location: _, 480 - name_location: _, 481 - annotation: _, 482 - value: _, 483 - }) => { 484 - let _ = constants.insert( 485 - name.clone(), 486 - ConstantInterface { 487 - implementations: ImplementationsInterface::from_implementations( 488 - implementations, 489 - ), 490 - type_: TypeInterface::from_type(type_.as_ref()), 491 - deprecation: DeprecationInterface::from_deprecation(deprecation), 492 - documentation: documentation.as_ref().map(|(_, doc)| doc.clone()), 493 - }, 494 - ); 495 - } 457 + for (name, alias) in interface 458 + .type_aliases 459 + .iter() 460 + .filter(|(_, v)| v.publicity.is_public()) 461 + { 462 + let _ = type_aliases.insert( 463 + name.clone(), 464 + TypeAliasInterface { 465 + documentation: alias.documentation.clone(), 466 + deprecation: DeprecationInterface::from_deprecation(&alias.deprecation), 467 + parameters: alias.arity, 468 + alias: TypeInterface::from_type(&alias.type_), 469 + }, 470 + ); 471 + } 496 472 497 - // A public top-level function. 498 - Definition::Function(Function { 499 - publicity: Publicity::Public, 500 - name, 501 - arguments, 502 - deprecation, 503 - return_type, 504 - documentation, 505 - implementations, 506 - location: _, 507 - end_position: _, 508 - body: _, 509 - return_annotation: _, 510 - external_erlang: _, 511 - external_javascript: _, 512 - }) => { 473 + for (name, value) in interface 474 + .values 475 + .iter() 476 + .filter(|(_, v)| v.publicity.is_public()) 477 + { 478 + match (value.type_.as_ref(), value.variant.clone()) { 479 + ( 480 + Type::Fn { 481 + args: arguments, 482 + retrn: return_type, 483 + }, 484 + ValueConstructorVariant::ModuleFn { 485 + documentation, 486 + implementations, 487 + .. 488 + }, 489 + ) => { 513 490 let mut id_map = IdMap::new(); 514 - let (_, name) = name 515 - .as_ref() 516 - .expect("Function in a definition must be named"); 491 + 517 492 let _ = functions.insert( 518 493 name.clone(), 519 494 FunctionInterface { 520 495 implementations: ImplementationsInterface::from_implementations( 521 - implementations, 496 + &implementations, 522 497 ), 523 - deprecation: DeprecationInterface::from_deprecation(deprecation), 524 - documentation: documentation.as_ref().map(|(_, doc)| doc.clone()), 498 + deprecation: DeprecationInterface::from_deprecation(&value.deprecation), 499 + documentation, 525 500 parameters: arguments 526 501 .iter() 527 502 .map(|arg| ParameterInterface { 528 - label: arg.names.get_label().cloned(), 529 - type_: from_type_helper(arg.type_.as_ref(), &mut id_map), 503 + // TODO: fixme 504 + label: None, 505 + type_: from_type_helper(arg, &mut id_map), 530 506 }) 531 507 .collect(), 532 - return_: from_type_helper(return_type, &mut id_map), 508 + return_: from_type_helper(&return_type, &mut id_map), 533 509 }, 534 510 ); 535 511 } 536 512 537 - // Private or internal definitions are not included. 538 - Definition::Function(_) => {} 539 - Definition::CustomType(_) => {} 540 - Definition::ModuleConstant(_) => {} 541 - Definition::TypeAlias(_) => {} 513 + ( 514 + type_, 515 + ValueConstructorVariant::ModuleConstant { 516 + documentation, 517 + implementations, 518 + .. 519 + }, 520 + ) => { 521 + let _ = constants.insert( 522 + name.clone(), 523 + ConstantInterface { 524 + implementations: ImplementationsInterface::from_implementations( 525 + &implementations, 526 + ), 527 + type_: TypeInterface::from_type(type_), 528 + deprecation: DeprecationInterface::from_deprecation(&value.deprecation), 529 + documentation, 530 + }, 531 + ); 532 + } 542 533 543 - // Imports are ignored. 544 - Definition::Import(_) => {} 534 + _ => {} 545 535 } 546 536 } 547 537 548 538 ModuleInterface { 549 - documentation: module.ast.documentation.clone(), 539 + documentation: interface.documentation.clone(), 550 540 types, 551 541 type_aliases, 552 542 constants,
+6 -1
compiler-core/src/package_interface/tests.rs
··· 135 135 }; 136 136 module.attach_doc_and_module_comments(); 137 137 let package: Package = package_from_module(module); 138 - serde_json::to_string_pretty(&PackageInterface::from_package(&package)).expect("to json") 138 + serde_json::to_string_pretty(&PackageInterface::from_package( 139 + &package, 140 + &Default::default(), 141 + )) 142 + .expect("to json") 139 143 } 140 144 141 145 fn package_from_module(module: Module) -> Package { ··· 173 177 .expect("internals glob"), 174 178 ]), 175 179 }, 180 + module_names: vec![module.name.clone()], 176 181 modules: vec![module], 177 182 } 178 183 }
+8 -1
compiler-core/src/type_.rs
··· 886 886 pub warnings: Vec<Warning>, 887 887 /// The minimum Gleam version needed to use this module. 888 888 pub minimum_required_version: Version, 889 + pub type_aliases: HashMap<EcoString, TypeAliasConstructor>, 890 + pub documentation: Vec<EcoString>, 889 891 } 890 892 891 893 impl ModuleInterface { ··· 954 956 pub struct TypeValueConstructorField { 955 957 /// This type of this parameter 956 958 pub type_: Arc<Type>, 959 + pub label: Option<EcoString>, 957 960 } 958 961 959 962 impl ModuleInterface { ··· 1208 1211 #[derive(Debug, Clone, PartialEq, Eq)] 1209 1212 pub struct TypeConstructor { 1210 1213 pub publicity: Publicity, 1214 + pub opaque: bool, 1211 1215 pub origin: SrcSpan, 1212 1216 pub module: EcoString, 1213 1217 pub parameters: Vec<Arc<Type>>, ··· 1302 1306 pub struct TypeAliasConstructor { 1303 1307 pub publicity: Publicity, 1304 1308 pub module: EcoString, 1305 - pub type_: Type, 1309 + pub type_: Arc<Type>, 1306 1310 pub arity: usize, 1311 + pub deprecation: Deprecation, 1312 + pub documentation: Option<EcoString>, 1313 + pub origin: SrcSpan, 1307 1314 } 1308 1315 1309 1316 impl ValueConstructor {
+25
compiler-core/src/type_/environment.rs
··· 47 47 /// Mapping from types to constructor names in the current module (or the prelude) 48 48 pub module_types_constructors: HashMap<EcoString, TypeVariantConstructors>, 49 49 50 + pub module_type_aliases: HashMap<EcoString, TypeAliasConstructor>, 51 + 50 52 /// Values defined in the current module (or the prelude) 51 53 pub module_values: HashMap<EcoString, ValueConstructor>, 52 54 ··· 115 117 entity_usages: vec![HashMap::new()], 116 118 target_support, 117 119 names, 120 + module_type_aliases: HashMap::new(), 118 121 } 119 122 } 120 123 } ··· 311 314 let name = type_name.clone(); 312 315 let location = info.origin; 313 316 match self.module_types.insert(type_name, info) { 317 + None => Ok(()), 318 + Some(prelude_type) if is_prelude_module(&prelude_type.module) => Ok(()), 319 + Some(previous) => Err(Error::DuplicateTypeName { 320 + name, 321 + location, 322 + previous_location: previous.origin, 323 + }), 324 + } 325 + } 326 + 327 + /// Map a type alias in the current scope. 328 + /// Errors if the module already has a type with that name, unless the type is from the 329 + /// prelude. 330 + /// 331 + pub fn insert_type_alias( 332 + &mut self, 333 + type_name: EcoString, 334 + info: TypeAliasConstructor, 335 + ) -> Result<(), Error> { 336 + let name = type_name.clone(); 337 + let location = info.origin; 338 + match self.module_type_aliases.insert(type_name, info) { 314 339 None => Ok(()), 315 340 Some(prelude_type) if is_prelude_module(&prelude_type.module) => Ok(()), 316 341 Some(previous) => Err(Error::DuplicateTypeName {
+13
compiler-core/src/type_/prelude.rs
··· 241 241 // prelude doesn't have real line numbers 242 242 line_numbers: LineNumbers::new(""), 243 243 minimum_required_version: Version::new(0, 1, 0), 244 + type_aliases: HashMap::new(), 245 + documentation: Vec::new(), 244 246 }; 245 247 246 248 for t in PreludeType::iter() { ··· 254 256 publicity: Publicity::Public, 255 257 deprecation: NotDeprecated, 256 258 documentation: None, 259 + opaque: false, 257 260 }; 258 261 let _ = prelude.types.insert(BIT_ARRAY.into(), v.clone()); 259 262 } ··· 317 320 publicity: Publicity::Public, 318 321 deprecation: NotDeprecated, 319 322 documentation: None, 323 + opaque: false, 320 324 }, 321 325 ); 322 326 } ··· 332 336 publicity: Publicity::Public, 333 337 deprecation: NotDeprecated, 334 338 documentation: None, 339 + opaque: false, 335 340 }, 336 341 ); 337 342 } ··· 347 352 publicity: Publicity::Public, 348 353 deprecation: NotDeprecated, 349 354 documentation: None, 355 + opaque: false, 350 356 }, 351 357 ); 352 358 } ··· 363 369 publicity: Publicity::Public, 364 370 deprecation: NotDeprecated, 365 371 documentation: None, 372 + opaque: false, 366 373 }, 367 374 ); 368 375 } ··· 394 401 publicity: Publicity::Public, 395 402 deprecation: NotDeprecated, 396 403 documentation: None, 404 + opaque: false, 397 405 }, 398 406 ); 399 407 let _ = prelude.types_value_constructors.insert( ··· 423 431 publicity: Publicity::Public, 424 432 deprecation: NotDeprecated, 425 433 documentation: None, 434 + opaque: false, 426 435 }, 427 436 ); 428 437 let _ = prelude.types_value_constructors.insert( ··· 434 443 name: "Ok".into(), 435 444 parameters: vec![TypeValueConstructorField { 436 445 type_: result_value, 446 + label: None, 437 447 }], 438 448 }, 439 449 TypeValueConstructor { 440 450 name: "Error".into(), 441 451 parameters: vec![TypeValueConstructorField { 442 452 type_: result_error, 453 + label: None, 443 454 }], 444 455 }, 445 456 ], ··· 494 505 publicity: Publicity::Public, 495 506 deprecation: NotDeprecated, 496 507 documentation: None, 508 + opaque: false, 497 509 }, 498 510 ); 499 511 } ··· 509 521 publicity: Publicity::Public, 510 522 deprecation: NotDeprecated, 511 523 documentation: None, 524 + opaque: false, 512 525 }, 513 526 ); 514 527 }
+4 -1
compiler-core/src/type_/tests.rs
··· 818 818 package: "thepackage".into(), 819 819 name: "ok".into(), 820 820 is_internal: false, 821 - // Core type constructors like String and Int are not included 822 821 types: HashMap::new(), 823 822 types_value_constructors: HashMap::from([ 824 823 ( ··· 846 845 name: "Ok".into(), 847 846 parameters: vec![TypeValueConstructorField { 848 847 type_: generic_var(1), 848 + label: None, 849 849 }] 850 850 }, 851 851 TypeValueConstructor { 852 852 name: "Error".into(), 853 853 parameters: vec![TypeValueConstructorField { 854 854 type_: generic_var(2), 855 + label: None, 855 856 }] 856 857 } 857 858 ] ··· 873 874 line_numbers: LineNumbers::new(""), 874 875 src_path: "".into(), 875 876 minimum_required_version: Version::new(0, 1, 0), 877 + type_aliases: HashMap::new(), 878 + documentation: Vec::new(), 876 879 } 877 880 ); 878 881 }