diff --git a/compiler/testData/diagnostics/tests/operatorsOverloading/kt1028.jet b/compiler/testData/diagnostics/tests/operatorsOverloading/kt1028.jet new file mode 100644 index 00000000000..f1d9b702e47 --- /dev/null +++ b/compiler/testData/diagnostics/tests/operatorsOverloading/kt1028.jet @@ -0,0 +1,36 @@ +//KT-1028 Wrong type checking for plusAssign +//+JDK +package kt1028 + +import java.util.* + +class event() +{ + val callbacks = ArrayList< Function1 >() // Should be ArrayList<()->Unit>, bug posted + + fun plusAssign(f : (T) -> Unit) = callbacks.add(f) + fun minusAssign(f : (T) -> Unit) = callbacks.remove(f) + fun call(value : T) = for(c in callbacks) c(value) +} + +class MouseMovedEventArgs() +{ + public val X : Int = 0 +} + +class Control() +{ + public val MouseMoved : event = event() + + fun MoveMouse() = MouseMoved.call(MouseMovedEventArgs()) +} + +class Test() +{ + fun test() + { + val control = Control() + control.MouseMoved += { it.X } // here + control.MouseMoved.plusAssign( { it.X } ) // ok + } +} \ No newline at end of file