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

Configure Feed

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

improve test by adding another redeclaration before case

+12 -6
+4
compiler-core/src/javascript/tests/case.rs
··· 1001 1001 ) 1002 1002 } 1003 1003 1004 + // https://github.com/gleam-lang/gleam/issues/5612 1005 + #[test] 1004 1006 fn no_duplicate_let_after_case_with_same_named_variable_with_declaration_before_and_after() { 1005 1007 assert_js!( 1006 1008 r#" 1007 1009 pub fn go() { 1008 1010 let x = 0 1011 + let x = x 1009 1012 let x = case #(1, 2) { 1010 1013 #(_, x) -> x 1011 1014 } ··· 1016 1019 ) 1017 1020 } 1018 1021 1022 + // https://github.com/gleam-lang/gleam/issues/5612 1019 1023 #[test] 1020 1024 fn no_duplicate_let_after_case_with_same_named_variable() { 1021 1025 assert_js!(
+8 -6
compiler-core/src/javascript/tests/snapshots/gleam_core__javascript__tests__case__no_duplicate_let_after_case_with_same_named_variable_with_declaration_before_and_after.snap
··· 1 1 --- 2 2 source: compiler-core/src/javascript/tests/case.rs 3 - expression: "\npub fn go() {\n let x = 0\n let x = case #(1, 2) {\n #(_, x) -> x\n }\n\n let x = x\n x\n}" 3 + expression: "\npub fn go() {\n let x = 0\n let x = x\n let x = case #(1, 2) {\n #(_, x) -> x\n }\n\n let x = x\n x\n}" 4 4 --- 5 5 ----- SOURCE CODE 6 6 7 7 pub fn go() { 8 8 let x = 0 9 + let x = x 9 10 let x = case #(1, 2) { 10 11 #(_, x) -> x 11 12 } ··· 17 18 ----- COMPILED JAVASCRIPT 18 19 export function go() { 19 20 let x = 0; 21 + let x$1 = x; 20 22 let _block; 21 23 let $ = [1, 2]; 22 - let x$1 = $[1]; 23 - _block = x$1; 24 - let x$2 = _block; 25 - let x$3 = x$2; 26 - return x$3; 24 + let x$2 = $[1]; 25 + _block = x$2; 26 + let x$3 = _block; 27 + let x$4 = x$3; 28 + return x$4; 27 29 }