File tree Expand file tree Collapse file tree
main/java/de/peeeq/datastructures
test/java/tests/wurstscript/tests Expand file tree Collapse file tree Original file line number Diff line number Diff line change 44import com .google .common .collect .Lists ;
55import com .google .common .collect .Sets ;
66import de .peeeq .wurstscript .utils .Utils ;
7+ import it .unimi .dsi .fastutil .objects .Object2IntLinkedOpenHashMap ;
78import org .eclipse .jdt .annotation .Nullable ;
89
910import java .util .*;
@@ -81,8 +82,8 @@ public Set<Set<T>> findStronglyConnectedComponents(List<T> nodes) {
8182 Deque <T > p = new ArrayDeque <>();
8283 AtomicInteger c = new AtomicInteger ();
8384 AtomicInteger componentCount = new AtomicInteger ();
84- Map < T , Integer > preorderNumber = new HashMap <>();
85- Map < T , Integer > component = new HashMap <>();
85+ Object2IntLinkedOpenHashMap < T > preorderNumber = new Object2IntLinkedOpenHashMap <>();
86+ Object2IntLinkedOpenHashMap < T > component = new Object2IntLinkedOpenHashMap <>();
8687
8788 // This stack simulates the recursive calls
8889 Deque <T > traversalStack = new ArrayDeque <>();
Original file line number Diff line number Diff line change @@ -991,6 +991,23 @@ public void extensionMethodStatic() { // See #614
991991
992992 }
993993
994+ @ Test
995+ public void testNameShadowError () {
996+ testAssertErrorsLines (true , "Variable x hides an other local variable with the same name" ,
997+ "package Test" ,
998+ "native testSuccess()" ,
999+ "function foo() returns bool" ,
1000+ " var x = 0" ,
1001+ " var sum = 0" ,
1002+ " for x in x" ,
1003+ " sum += x" ,
1004+ " return true" ,
1005+ "init" ,
1006+ " if foo()" ,
1007+ " testSuccess()"
1008+ );
1009+ }
1010+
9941011 @ Test
9951012 public void testCyclicDependencyError () {
9961013 testAssertErrorsLines (true , "For loop target int doesn't provide a iterator() function" ,
@@ -999,8 +1016,8 @@ public void testCyclicDependencyError() {
9991016 "function foo() returns bool" ,
10001017 " var x = 0" ,
10011018 " var sum = 0" ,
1002- " for x in x" ,
1003- " sum += x " ,
1019+ " for i in x" ,
1020+ " sum += i " ,
10041021 " return true" ,
10051022 "init" ,
10061023 " if foo()" ,
You can’t perform that action at this time.
0 commit comments