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

Configure Feed

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

Remove unused code

+3 -101
+3 -19
compiler-cli/src/publish.rs
··· 275 275 return Err(Error::CannotPublishTodo { unfinished }); 276 276 } 277 277 278 - // TODO: This is commented out until we figure out a better way to 279 - // deal with reexports of internal types. 280 - // As things stand it would break both Lustre and Mist. 281 - // You can see the thread starting around here for more 282 - // context: https://discord.com/channels/768594524158427167/768594524158427170/1227250677734969386 283 - // 284 - // 285 - // If any of the modules in the package contain a leaked internal type then 278 + // TODO: If any of the modules in the package contain a leaked internal type then 286 279 // refuse to publish as the package is not yet finished. 287 - // let unfinished = built 288 - // .root_package 289 - // .modules 290 - // .iter() 291 - // .filter(|module| module.ast.type_info.leaks_internal_types) 292 - // .map(|module| module.name.clone()) 293 - // .sorted() 294 - // .collect_vec(); 295 - // if !unfinished.is_empty() { 296 - // return Err(Error::CannotPublishLeakedInternalType { unfinished }); 297 - // } 280 + // We need to move aliases in to the type system first. 281 + // context: https://discord.com/channels/768594524158427167/768594524158427170/1227250677734969386 298 282 299 283 // Collect all the files we want to include in the tarball 300 284 let generated_files = match target {
-12
compiler-core/generated/schema_capnp.rs
··· 501 501 pub fn get_is_internal(self) -> bool { 502 502 self.reader.get_bool_field(1) 503 503 } 504 - #[inline] 505 - pub fn get_leaks_internal_types(self) -> bool { 506 - self.reader.get_bool_field(2) 507 - } 508 504 } 509 505 510 506 pub struct Builder<'a> { builder: ::capnp::private::layout::StructBuilder<'a> } ··· 714 710 #[inline] 715 711 pub fn set_is_internal(&mut self, value: bool) { 716 712 self.builder.set_bool_field(1, value); 717 - } 718 - #[inline] 719 - pub fn get_leaks_internal_types(self) -> bool { 720 - self.builder.get_bool_field(2) 721 - } 722 - #[inline] 723 - pub fn set_leaks_internal_types(&mut self, value: bool) { 724 - self.builder.set_bool_field(2, value); 725 713 } 726 714 } 727 715
-1
compiler-core/schema.capnp
··· 31 31 lineNumbers @8 :LineNumbers; 32 32 srcPath @9 :Text; 33 33 isInternal @10 :Bool; 34 - leaksInternalTypes @11 :Bool; 35 34 } 36 35 37 36 struct TypesVariantConstructors {
-16
compiler-core/src/analyse.rs
··· 252 252 env.accessors 253 253 .retain(|_, accessors| accessors.publicity.is_importable()); 254 254 255 - let mut leaked_internal_type_encountered = false; 256 - 257 255 // Ensure no exported values have private types in their type signature 258 256 for value in env.module_values.values() { 259 257 if value.publicity.is_private() { ··· 276 274 if package_config.is_internal_module(name.as_str()) { 277 275 continue; 278 276 } 279 - if let Some(_leaked) = value.type_.find_internal_type() { 280 - leaked_internal_type_encountered = true; 281 - // TODO: This is commented out until we figure out a better way to 282 - // deal with reexports of internal types. 283 - // As things stand it would break both Lustre and Mist. 284 - // You can see the thread starting around here for more 285 - // context: https://discord.com/channels/768594524158427167/768594524158427170/1227250677734969386 286 - // 287 - // env.warnings.emit(type_::Warning::InternalTypeLeak { 288 - // location: value.variant.definition_location(), 289 - // leaked, 290 - // }) 291 - } 292 277 } 293 278 294 279 let Environment { ··· 317 302 is_internal, 318 303 unused_imports, 319 304 contains_todo, 320 - leaks_internal_types: leaked_internal_type_encountered, 321 305 line_numbers, 322 306 src_path, 323 307 },
-1
compiler-core/src/build/package_loader/tests.rs
··· 51 51 accessors: Default::default(), 52 52 unused_imports: Vec::new(), 53 53 contains_todo: false, 54 - leaks_internal_types: false, 55 54 line_numbers: line_numbers.clone(), 56 55 is_internal: false, 57 56 src_path: Utf8PathBuf::from(format!("/src/{}.gleam", name)),
-1
compiler-core/src/metadata/module_decoder.rs
··· 70 70 package: reader.get_package()?.into(), 71 71 is_internal: reader.get_is_internal(), 72 72 contains_todo: reader.get_contains_todo(), 73 - leaks_internal_types: reader.get_leaks_internal_types(), 74 73 origin: Origin::Src, 75 74 values: read_hashmap!(reader.get_values()?, self, value_constructor), 76 75 types: read_hashmap!(reader.get_types()?, self, type_constructor),
-1
compiler-core/src/metadata/module_encoder.rs
··· 42 42 module.set_package(&self.data.package); 43 43 module.set_contains_todo(self.data.contains_todo); 44 44 module.set_src_path(self.data.src_path.as_str()); 45 - module.set_leaks_internal_types(self.data.leaks_internal_types); 46 45 module.set_is_internal(self.data.is_internal); 47 46 self.set_module_types(&mut module); 48 47 self.set_module_values(&mut module);
-46
compiler-core/src/metadata/tests.rs
··· 32 32 ModuleInterface { 33 33 is_internal: true, 34 34 contains_todo: false, 35 - leaks_internal_types: false, 36 35 package: "some_package".into(), 37 36 origin: Origin::Src, 38 37 name: "a".into(), ··· 87 86 let module = ModuleInterface { 88 87 is_internal: true, 89 88 contains_todo: false, 90 - leaks_internal_types: false, 91 89 package: "some_package".into(), 92 90 origin: Origin::Src, 93 91 name: "one/two".into(), ··· 107 105 let module = ModuleInterface { 108 106 is_internal: false, 109 107 contains_todo: false, 110 - leaks_internal_types: false, 111 108 package: "some_package".into(), 112 109 origin: Origin::Src, 113 110 name: "one/two".into(), ··· 131 128 let module = ModuleInterface { 132 129 is_internal: false, 133 130 contains_todo: false, 134 - leaks_internal_types: false, 135 131 package: "some_package".into(), 136 132 origin: Origin::Src, 137 133 name: "a/b".into(), ··· 162 158 let module = ModuleInterface { 163 159 is_internal: false, 164 160 contains_todo: false, 165 - leaks_internal_types: false, 166 161 package: "some_package".into(), 167 162 origin: Origin::Src, 168 163 name: "a".into(), ··· 185 180 let module = ModuleInterface { 186 181 is_internal: false, 187 182 contains_todo: false, 188 - leaks_internal_types: false, 189 183 package: "some_package".into(), 190 184 origin: Origin::Src, 191 185 name: "a/b".into(), ··· 216 210 let module = ModuleInterface { 217 211 is_internal: false, 218 212 contains_todo: false, 219 - leaks_internal_types: false, 220 213 package: "some_package".into(), 221 214 origin: Origin::Src, 222 215 name: "a/b".into(), ··· 247 240 let module = ModuleInterface { 248 241 is_internal: false, 249 242 contains_todo: false, 250 - leaks_internal_types: false, 251 243 package: "some_package".into(), 252 244 origin: Origin::Src, 253 245 name: "a/b".into(), ··· 284 276 ModuleInterface { 285 277 is_internal: false, 286 278 contains_todo: false, 287 - leaks_internal_types: false, 288 279 package: "some_package".into(), 289 280 origin: Origin::Src, 290 281 name: "a/b".into(), ··· 321 312 ModuleInterface { 322 313 is_internal: false, 323 314 contains_todo: false, 324 - leaks_internal_types: false, 325 315 package: "some_package".into(), 326 316 origin: Origin::Src, 327 317 name: "a".into(), ··· 354 344 let module = ModuleInterface { 355 345 is_internal: false, 356 346 contains_todo: false, 357 - leaks_internal_types: false, 358 347 package: "some_package".into(), 359 348 origin: Origin::Src, 360 349 name: "a".into(), ··· 385 374 let module = ModuleInterface { 386 375 is_internal: false, 387 376 contains_todo: false, 388 - leaks_internal_types: false, 389 377 package: "some_package".into(), 390 378 origin: Origin::Src, 391 379 name: "a".into(), ··· 431 419 let module = ModuleInterface { 432 420 is_internal: false, 433 421 contains_todo: false, 434 - leaks_internal_types: false, 435 422 package: "some_package".into(), 436 423 origin: Origin::Src, 437 424 name: "a".into(), ··· 479 466 let module = ModuleInterface { 480 467 is_internal: false, 481 468 contains_todo: false, 482 - leaks_internal_types: false, 483 469 package: "some_package".into(), 484 470 origin: Origin::Src, 485 471 name: "a".into(), ··· 527 513 let module = ModuleInterface { 528 514 is_internal: false, 529 515 contains_todo: false, 530 - leaks_internal_types: false, 531 516 package: "some_package".into(), 532 517 origin: Origin::Src, 533 518 name: "a/b/c".into(), ··· 574 559 let module = ModuleInterface { 575 560 is_internal: false, 576 561 contains_todo: false, 577 - leaks_internal_types: false, 578 562 package: "some_package".into(), 579 563 origin: Origin::Src, 580 564 name: "a".into(), ··· 623 607 let module = ModuleInterface { 624 608 is_internal: false, 625 609 contains_todo: false, 626 - leaks_internal_types: false, 627 610 package: "some_package".into(), 628 611 origin: Origin::Src, 629 612 name: "a".into(), ··· 667 650 let module = ModuleInterface { 668 651 is_internal: false, 669 652 contains_todo: false, 670 - leaks_internal_types: false, 671 653 package: "some_package".into(), 672 654 origin: Origin::Src, 673 655 name: "a".into(), ··· 712 694 let module = ModuleInterface { 713 695 is_internal: false, 714 696 contains_todo: false, 715 - leaks_internal_types: false, 716 697 package: "some_package".into(), 717 698 origin: Origin::Src, 718 699 name: "a".into(), ··· 927 908 let module = ModuleInterface { 928 909 is_internal: false, 929 910 contains_todo: false, 930 - leaks_internal_types: false, 931 911 package: "some_package".into(), 932 912 origin: Origin::Src, 933 913 name: "a".into(), ··· 1148 1128 let module = ModuleInterface { 1149 1129 is_internal: false, 1150 1130 contains_todo: false, 1151 - leaks_internal_types: false, 1152 1131 package: "some_package".into(), 1153 1132 origin: Origin::Src, 1154 1133 name: "a/b".into(), ··· 1181 1160 let module = ModuleInterface { 1182 1161 contains_todo: true, 1183 1162 // ^^^^ It does, it does! 1184 - leaks_internal_types: false, 1185 - is_internal: false, 1186 - package: "some_package".into(), 1187 - origin: Origin::Src, 1188 - name: "a/b".into(), 1189 - types: [].into(), 1190 - types_value_constructors: HashMap::new(), 1191 - values: HashMap::new(), 1192 - unused_imports: Vec::new(), 1193 - accessors: HashMap::new(), 1194 - line_numbers: LineNumbers::new(""), 1195 - src_path: "some_path".into(), 1196 - }; 1197 - assert_eq!(roundtrip(&module), module); 1198 - } 1199 - 1200 - #[test] 1201 - fn leaks_internal_types() { 1202 - let module = ModuleInterface { 1203 - contains_todo: false, 1204 - leaks_internal_types: true, 1205 - // ^^^^ It does, it does! 1206 1163 is_internal: false, 1207 1164 package: "some_package".into(), 1208 1165 origin: Origin::Src, ··· 1223 1180 let module = ModuleInterface { 1224 1181 is_internal: false, 1225 1182 contains_todo: false, 1226 - leaks_internal_types: false, 1227 1183 package: "some_package".into(), 1228 1184 origin: Origin::Src, 1229 1185 name: "a/b/c".into(), ··· 1270 1226 let module = ModuleInterface { 1271 1227 is_internal: false, 1272 1228 contains_todo: false, 1273 - leaks_internal_types: false, 1274 1229 package: "some_package".into(), 1275 1230 origin: Origin::Src, 1276 1231 name: "a/b/c".into(), ··· 1318 1273 let module = ModuleInterface { 1319 1274 is_internal: false, 1320 1275 contains_todo: false, 1321 - leaks_internal_types: false, 1322 1276 package: "some_package".into(), 1323 1277 origin: Origin::Src, 1324 1278 name: "a/b/c".into(),
-2
compiler-core/src/type_.rs
··· 570 570 pub accessors: HashMap<EcoString, AccessorsMap>, 571 571 pub unused_imports: Vec<SrcSpan>, 572 572 pub contains_todo: bool, 573 - pub leaks_internal_types: bool, 574 573 /// Used for mapping to original source locations on disk 575 574 pub line_numbers: LineNumbers, 576 575 /// Used for determining the source path of the module on disk ··· 661 660 accessors: Default::default(), 662 661 unused_imports: Default::default(), 663 662 contains_todo: false, 664 - leaks_internal_types: false, 665 663 is_internal: false, 666 664 line_numbers, 667 665 src_path,
-1
compiler-core/src/type_/prelude.rs
··· 211 211 accessors: HashMap::new(), 212 212 unused_imports: Vec::new(), 213 213 contains_todo: false, 214 - leaks_internal_types: false, 215 214 is_internal: false, 216 215 // prelude doesn't have real src 217 216 src_path: "".into(),
-1
compiler-core/src/type_/tests.rs
··· 633 633 module.type_info, 634 634 ModuleInterface { 635 635 contains_todo: false, 636 - leaks_internal_types: false, 637 636 origin: Origin::Src, 638 637 package: "thepackage".into(), 639 638 name: "ok".into(),