| Issue 196: | Accessing property typed by a typed parameter fails to compile if type is a function | |
| 2 people starred this issue and may be notified of changes. | Back to list |
A bit of a mouthful to describe - easier to demonstrate in code :)
What steps will reproduce the problem?
1.
class Main
{
public static function main()
{
var example = new Example<Void->Void>();
example.listener = handler;
var listener = example.listener;
listener();
}
public static function handler():Void
{
trace("hello");
}
}
class Example<TListener>
{
public var listener:TListener;
public function new()
{
}
}
2. Compile
haxe -main Main -cpp cpp -debug -cmd cpp/Main-debug
3.
What is the expected output? What do you see instead?
Expected output is to compile and print 'Main.hx:13: hello'
Actual compiler output:
haxelib run hxcpp Build.xml haxe -Ddebug -Dcpp -Ddebug -Dhaxe_208 -Dhaxe_209 -Dhaxe_210 -Dsys -Dtrue
Creating hxcpp.h.gch...
g++ -Iinclude -c -fvisibility=hidden -g -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk -I/usr/lib/haxe/lib/hxcpp/2,10//include -DHX_MACOS -m32 -DHXCPP_DEBUG -DHXCPP_VISIT_ALLOCS -Dhaxe_210 -frtti -o hxcpp.h.gch /usr/lib/haxe/lib/hxcpp/2,10//include/hxcpp.h
g++ -I. -Iinclude -c -fvisibility=hidden -g -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk -I/usr/lib/haxe/lib/hxcpp/2,10//include -DHX_MACOS -m32 -DHXCPP_DEBUG -DHXCPP_VISIT_ALLOCS -Dhaxe_210 -x c++ -frtti ./src/Main.cpp -oobj/darwin-debug//src/Main.o
./src/Main.cpp: In static member function ‘static Void Main_obj::main()’:
./src/Main.cpp:39: error: ‘class Example_obj’ has no member named ‘listener_dyn’
Called from ? line 1
Called from BuildTool.hx line 1265
Called from BuildTool.hx line 554
Called from a C function
Called from BuildTool.hx line 591
Called from BuildTool.hx line 710
Called from BuildTool.hx line 744
Called from BuildTool.hx line 200
Uncaught exception - Error : 256 - build cancelled
What version of the product are you using? On what operating system?
hxcpp 2.10, Haxe 2.10, osx 10.8
Please provide any additional information below.
Can be worked around by converting listener property into a getter/setter (must have getter to compile though)
public var listener(get_listener, set_listener):TListener;
function get_listener():TListener
{
return listener;
}
function set_listener(value:TListener):TListener
{
listener = value;
return listener;
}
Feb 12, 2013
Project Member
#1
gameh...@gmail.com
Status:
Fixed
|