Skip to content

Commit 10387c1

Browse files
committed
Update GenericsWithTypeclassesTests.java
1 parent 546549f commit 10387c1

1 file changed

Lines changed: 34 additions & 0 deletions

File tree

de.peeeq.wurstscript/src/test/java/tests/wurstscript/tests/GenericsWithTypeclassesTests.java

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1843,5 +1843,39 @@ public void arrayListInClosure() {
18431843
);
18441844
}
18451845

1846+
@Test
1847+
public void genericClassWithModule() {
1848+
testAssertOkLines(true,
1849+
"package test",
1850+
"native testSuccess()",
1851+
"module M",
1852+
" static thistype first = null",
1853+
" static thistype last = null",
1854+
" static int size = 0",
1855+
" thistype prev",
1856+
" thistype next",
1857+
" construct()",
1858+
" size++",
1859+
" if size == 1",
1860+
" first = this",
1861+
" prev = null",
1862+
" else",
1863+
" last.next = this",
1864+
"class Box<T:>",
1865+
" use M",
1866+
" private T value",
1867+
" function setValue(T v)",
1868+
" value = v",
1869+
" function getValue() returns T",
1870+
" return value",
1871+
"init",
1872+
" let b = new Box<int>",
1873+
" b.setValue(42)",
1874+
" if b.getValue() == 42 and b.prev == null",
1875+
" testSuccess()",
1876+
"endpackage"
1877+
);
1878+
}
1879+
18461880

18471881
}

0 commit comments

Comments
 (0)