From 7819b84475ca6ba1cf3e9976c7140ea11775b81d Mon Sep 17 00:00:00 2001 From: Araq Date: Tue, 15 Nov 2011 23:03:14 +0100 Subject: bugfixes: objects still invalid for constants; fixed a typo concerning 'high' in eval context --- tests/reject/tactiontable2.nim | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 tests/reject/tactiontable2.nim (limited to 'tests/reject') diff --git a/tests/reject/tactiontable2.nim b/tests/reject/tactiontable2.nim new file mode 100644 index 000000000..dbfa42f18 --- /dev/null +++ b/tests/reject/tactiontable2.nim @@ -0,0 +1,28 @@ +discard """ + line: 21 + errormsg: "invalid type: 'TTable'" +""" + +import tables + +proc action1(arg: string) = + echo "action 1 ", arg + +proc action2(arg: string) = + echo "action 2 ", arg + +proc action3(arg: string) = + echo "action 3 ", arg + +proc action4(arg: string) = + echo "action 4 ", arg + +const + actionTable = { + "A": action1, + "B": action2, + "C": action3, + "D": action4}.toTable + +actionTable["C"]("arg") + -- cgit 1.4.1-2-gfad0