WurstScript icon indicating copy to clipboard operation
WurstScript copied to clipboard

Double module usage causes strange problems

Open Frotty opened this issue 6 years ago • 0 comments

The following

package Test
import LinkedListModule

class A
	use LinkedListModule

class B extends A
	use LinkedListModule

class C extends A

class D extends C
	use LinkedListModule

function doSmth()
	for a in A
		// Compiles, but ??
	for b in B
		// Compiles, but ??

	B b2 = B.first // Error, cannot assign A to B

	var d = D.first
	while d != null
		d = d.next // Works in this example, but not in EBR case

should at least be prevented with a warning or error. It is unclear whether only Bs only non-B As, or all As are iterated, and it throws weird errors ingame. In EBR I also encounter a bug with the last case:

Ideally implement https://github.com/wurstscript/WurstScript/issues/214 I suppose.

Frotty avatar May 05 '19 11:05 Frotty