String concatenation is not intuitive (1)
Actual behavior:
- Write the following code: “main(“User:” output(u.fullname) “:”)”
- Follow the suggestion from the eclipse plugin “expecting >”
- Write the following code: “main(“User:” > output(u.fullname) > “:”)”
- Building results in:
[ Main | info ] stage 2: importing modulesException in thread “main” org.strategoxt.lang.StrategoException: Exception in execution of primitive ‘STRSGLR_anno_location’
Expected behavior:
Submitted by Sverre Rabbelier on 26 February 2010 at 13:46
- I expect to be directed to the “string concatenation operator” instead, rather than a random operator that results in weird exceptions.
Issue Log
Could you add a copy of the stack trace you get when you do this? And a minimal copy of the file that caused this could also help us reproduce this problem.
Do note, however, that there’s no string concatenation available to do this.
output
is not a function that returns a string, it is a template. What you can do instead is:main("User: " + u.fullname + ": ")
Ah, in that case please do update the documentation of the String class to reflect that. (And we did figure out that ‘output’ is not the appropriate here, but I thought it might be relevant for the bug report).
Will post full stack trace later.
Full stack:
[echo] Classpath: D:/Program Files/eclipse/plugins/webdsl.editor_1.0.0.201002091647//include/webdsl.jar [java] [ Main | info ] stage 1: parsing Gamestile.app : [user/system] = [2,47s/0,00s] [java] [ Main | info ] stage 2: importing modulesException in thread "main" org.strategoxt.lang.StrategoException: Exception in execution of primitive 'STRSGLR_anno_location' [java] at org.strategoxt.lang.Context.invokePrimitive(Context.java:209) [java] at org.strategoxt.lang.Context.invokePrimitive(Context.java:190) [java] at org.strategoxt.lang.compat.override.jsglr_parser_compat.asfix_anno_location_0_0_override.invoke(asfix_anno_location_0_0_override.java:22) [java] at org.webdsl.webdsl_front.implode_with_location_annos_0_1.invoke(implode_with_location_annos_0_1.java:27) [java] at org.webdsl.webdsl_front.parse_and_write_cache_0_3.invoke(parse_and_write_cache_0_3.java:73) [java] at org.webdsl.webdsl_front.xtc_parse_webdsl_unit_0_1.invoke(xtc_parse_webdsl_unit_0_1.java:160) [java] at org.webdsl.webdsl_front.xtc_parse_webdsl_module_0_0.invoke(xtc_parse_webdsl_module_0_0.java:36) [java] at org.webdsl.webdsl_generator.import_module_0_0.invoke(import_module_0_0.java:62) [java] at org.webdsl.webdsl_generator.lifted1940.invoke(lifted1940.java:37) [java] at org.strategoxt.stratego_lib.try_1_0.invoke(try_1_0.java:26) [java] at org.webdsl.webdsl_generator.lifted1939.invoke(lifted1939.java:26) [java] at org.strategoxt.stratego_lib.topdown_1_0.invoke(topdown_1_0.java:21) [java] at org.strategoxt.stratego_lib.lifted900.invoke(lifted900.java:20) [java] at org.strategoxt.lang.SRTS_all.mapIgnoreAnnos(SRTS_all.java:86) [java] at org.strategoxt.lang.SRTS_all.mapMaintainAnnos(SRTS_all.java:105) [java] at org.strategoxt.lang.SRTS_all.map(SRTS_all.java:66) [java] at org.strategoxt.lang.SRTS_all.invoke(SRTS_all.java:21) [java] at org.strategoxt.stratego_lib.topdown_1_0.invoke(topdown_1_0.java:26) [java] at org.strategoxt.stratego_lib.lifted900.invoke(lifted900.java:20) [java] at org.strategoxt.lang.SRTS_all.invoke(SRTS_all.java:28) [java] at org.strategoxt.stratego_lib.topdown_1_0.invoke(topdown_1_0.java:26) [java] at org.strategoxt.stratego_lib.lifted900.invoke(lifted900.java:20) [java] at org.strategoxt.lang.SRTS_all.map(SRTS_all.java:60) [java] at org.strategoxt.lang.SRTS_all.invoke(SRTS_all.java:21) [java] at org.strategoxt.stratego_lib.topdown_1_0.invoke(topdown_1_0.java:26) [java] at org.strategoxt.stratego_lib.lifted900.invoke(lifted900.java:20) [java] at org.strategoxt.lang.SRTS_all.invoke(SRTS_all.java:28) [java] at org.strategoxt.stratego_lib.topdown_1_0.invoke(topdown_1_0.java:26) [java] at org.webdsl.webdsl_generator.import_modules_0_0.invoke(import_modules_0_0.java:43) [java] at org.webdsl.webdsl_generator.lifted1918.invoke(lifted1918.java:31) [java] at org.webdsl.webdsl_front.log_timed_1_1.invoke(log_timed_1_1.java:48) [java] at org.webdsl.webdsl_front.stage_1_1.invoke(stage_1_1.java:74) [java] at org.webdsl.webdsl_generator.dsl_to_core_analysis_0_0.invoke(dsl_to_core_analysis_0_0.java:32) [java] at org.webdsl.webdsl_generator.dsl_to_core_0_0.invoke(dsl_to_core_0_0.java:27) [java] at org.webdsl.webdslc.xtc_webdslc_0_0.invoke(xtc_webdslc_0_0.java:75) [java] at org.webdsl.webdslc.lifted16.invoke(lifted16.java:31) [java] at org.strategoxt.stratego_xtc.lifted87.invoke(lifted87.java:38) [java] at org.strategoxt.stratego_lib.restore_always_2_0.invoke(restore_always_2_0.java:26) [java] at org.strategoxt.stratego_xtc.xtc_temp_files_1_0.invoke(xtc_temp_files_1_0.java:28) [java] at org.strategoxt.stratego_xtc.xtc_io_1_0.invoke(xtc_io_1_0.java:22) [java] at org.strategoxt.stratego_xtc.lifted134.invoke(lifted134.java:22) [java] at org.strategoxt.stratego_lib.option_wrap_5_0.invoke(option_wrap_5_0.java:32) [java] at org.strategoxt.stratego_xtc.xtc_io_wrap_5_0.invoke(xtc_io_wrap_5_0.java:25) [java] at org.webdsl.webdslc.webdslc_main_0_0.invoke(webdslc_main_0_0.java:32) [java] at org.strategoxt.lang.Context.invokeStrategyCLI(Context.java:158) [java] at org.webdsl.webdslc.Main.main(Main.java:113) [java] Caused by: java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to [Lorg.spoofax.interpreter.terms.IStrategoTerm; [java] at org.strategoxt.lang.compat.sglr.STRSGLR_anno_location$AsfixAnnoLocation.traverse(STRSGLR_anno_location.java:188) [java] at org.strategoxt.lang.compat.sglr.STRSGLR_anno_location$AsfixAnnoLocation.traverseArgs(STRSGLR_anno_location.java:152) [java] at org.strategoxt.lang.compat.sglr.STRSGLR_anno_location$AsfixAnnoLocation.traverse(STRSGLR_anno_location.java:173) [java] at org.strategoxt.lang.compat.sglr.STRSGLR_anno_location$AsfixAnnoLocation.traverseArgs(STRSGLR_anno_location.java:152) [java] at org.strategoxt.lang.compat.sglr.STRSGLR_anno_location$AsfixAnnoLocation.traverse(STRSGLR_anno_location.java:173) [java] at org.strategoxt.lang.compat.sglr.STRSGLR_anno_location$AsfixAnnoLocation.traverseArgs(STRSGLR_anno_location.java:152) [java] at org.strategoxt.lang.compat.sglr.STRSGLR_anno_location$AsfixAnnoLocation.traverseArgs(STRSGLR_anno_location.java:153) [java] at org.strategoxt.lang.compat.sglr.STRSGLR_anno_location$AsfixAnnoLocation.traverseArgs(STRSGLR_anno_location.java:153) [java] at org.strategoxt.lang.compat.sglr.STRSGLR_anno_location$AsfixAnnoLocation.traverseArgs(STRSGLR_anno_location.java:153) [java] at org.strategoxt.lang.compat.sglr.STRSGLR_anno_location$AsfixAnnoLocation.traverseArgs(STRSGLR_anno_location.java:153) [java] at org.strategoxt.lang.compat.sglr.STRSGLR_anno_location$AsfixAnnoLocation.traverse(STRSGLR_anno_location.java:173) [java] at org.strategoxt.lang.compat.sglr.STRSGLR_anno_location$AsfixAnnoLocation.traverseArgs(STRSGLR_anno_location.java:152) [java] at org.strategoxt.lang.compat.sglr.STRSGLR_anno_location$AsfixAnnoLocation.traverse(STRSGLR_anno_location.java:173) [java] at org.strategoxt.lang.compat.sglr.STRSGLR_anno_location$AsfixAnnoLocation.traverseArgs(STRSGLR_anno_location.java:152) [java] at org.strategoxt.lang.compat.sglr.STRSGLR_anno_location$AsfixAnnoLocation.traverse(STRSGLR_anno_location.java:173) [java] at org.strategoxt.lang.compat.sglr.STRSGLR_anno_location$AsfixAnnoLocation.traverseArgs(STRSGLR_anno_location.java:152) [java] at org.strategoxt.lang.compat.sglr.STRSGLR_anno_location$AsfixAnnoLocation.traverse(STRSGLR_anno_location.java:173) [java] at org.strategoxt.lang.compat.sglr.STRSGLR_anno_location$AsfixAnnoLocation.traverseArgs(STRSGLR_anno_location.java:152) [java] at org.strategoxt.lang.compat.sglr.STRSGLR_anno_location$AsfixAnnoLocation.traverseArgs(STRSGLR_anno_location.java:153) [java] at org.strategoxt.lang.compat.sglr.STRSGLR_anno_location$AsfixAnnoLocation.traverseArgs(STRSGLR_anno_location.java:153) [java] at org.strategoxt.lang.compat.sglr.STRSGLR_anno_location$AsfixAnnoLocation.traverseArgs(STRSGLR_anno_location.java:153) [java] at org.strategoxt.lang.compat.sglr.STRSGLR_anno_location$AsfixAnnoLocation.traverseArgs(STRSGLR_anno_location.java:153) [java] at org.strategoxt.lang.compat.sglr.STRSGLR_anno_location$AsfixAnnoLocation.traverseArgs(STRSGLR_anno_location.java:153) [java] at org.strategoxt.lang.compat.sglr.STRSGLR_anno_location$AsfixAnnoLocation.traverseArgs(STRSGLR_anno_location.java:153) [java] at org.strategoxt.lang.compat.sglr.STRSGLR_anno_location$AsfixAnnoLocation.traverseArgs(STRSGLR_anno_location.java:153) [java] at org.strategoxt.lang.compat.sglr.STRSGLR_anno_location$AsfixAnnoLocation.traverseArgs(STRSGLR_anno_location.java:153) [java] at org.strategoxt.lang.compat.sglr.STRSGLR_anno_location$AsfixAnnoLocation.traverseArgs(STRSGLR_anno_location.java:153) [java] at org.strategoxt.lang.compat.sglr.STRSGLR_anno_location$AsfixAnnoLocation.traverseArgs(STRSGLR_anno_location.java:153) [java] at org.strategoxt.lang.compat.sglr.STRSGLR_anno_location$AsfixAnnoLocation.traverseArgs(STRSGLR_anno_location.java:153) [java] at org.strategoxt.lang.compat.sglr.STRSGLR_anno_location$AsfixAnnoLocation.traverseArgs(STRSGLR_anno_location.java:153) [java] at org.strategoxt.lang.compat.sglr.STRSGLR_anno_location$AsfixAnnoLocation.traverseArgs(STRSGLR_anno_location.java:153) [java] at org.strategoxt.lang.compat.sglr.STRSGLR_anno_location$AsfixAnnoLocation.traverseArgs(STRSGLR_anno_location.java:153) [java] at org.strategoxt.lang.compat.sglr.STRSGLR_anno_location$AsfixAnnoLocation.traverseArgs(STRSGLR_anno_location.java:153) [java] at org.strategoxt.lang.compat.sglr.STRSGLR_anno_location$AsfixAnnoLocation.traverseArgs(STRSGLR_anno_location.java:153) [java] at org.strategoxt.lang.compat.sglr.STRSGLR_anno_location$AsfixAnnoLocation.traverse(STRSGLR_anno_location.java:173) [java] at org.strategoxt.lang.compat.sglr.STRSGLR_anno_location$AsfixAnnoLocation.traverseArgs(STRSGLR_anno_location.java:152) [java] at org.strategoxt.lang.compat.sglr.STRSGLR_anno_location$AsfixAnnoLocation.traverse(STRSGLR_anno_location.java:173) [java] at org.strategoxt.lang.compat.sglr.STRSGLR_anno_location$AsfixAnnoLocation.traverseArgs(STRSGLR_anno_location.java:152) [java] at org.strategoxt.lang.compat.sglr.STRSGLR_anno_location$AsfixAnnoLocation.traverse(STRSGLR_anno_location.java:173) [java] at org.strategoxt.lang.compat.sglr.STRSGLR_anno_location$AsfixAnnoLocation.traverseArgs(STRSGLR_anno_location.java:152) [java] at org.strategoxt.lang.compat.sglr.STRSGLR_anno_location$AsfixAnnoLocation.traverseArgs(STRSGLR_anno_location.java:153) [java] at org.strategoxt.lang.compat.sglr.STRSGLR_anno_location$AsfixAnnoLocation.traverseArgs(STRSGLR_anno_location.java:153) [java] at org.strategoxt.lang.compat.sglr.STRSGLR_anno_location$AsfixAnnoLocation.traverse(STRSGLR_anno_location.java:173) [java] at org.strategoxt.lang.compat.sglr.STRSGLR_anno_location$AsfixAnnoLocation.traverseArgs(STRSGLR_anno_location.java:152) [java] at org.strategoxt.lang.compat.sglr.STRSGLR_anno_location$AsfixAnnoLocation.traverse(STRSGLR_anno_location.java:173) [java] at org.strategoxt.lang.compat.sglr.STRSGLR_anno_location$AsfixAnnoLocation.traverseArgs(STRSGLR_anno_location.java:152) [java] at org.strategoxt.lang.compat.sglr.STRSGLR_anno_location$AsfixAnnoLocation.traverseArgs(STRSGLR_anno_location.java:153) [java] at org.strategoxt.lang.compat.sglr.STRSGLR_anno_location$AsfixAnnoLocation.traverseArgs(STRSGLR_anno_location.java:153) [java] at org.strategoxt.lang.compat.sglr.STRSGLR_anno_location$AsfixAnnoLocation.traverseArgs(STRSGLR_anno_location.java:153) [java] at org.strategoxt.lang.compat.sglr.STRSGLR_anno_location$AsfixAnnoLocation.traverse(STRSGLR_anno_location.java:173) [java] at org.strategoxt.lang.compat.sglr.STRSGLR_anno_location$AsfixAnnoLocation.traverseArgs(STRSGLR_anno_location.java:152) [java] at org.strategoxt.lang.compat.sglr.STRSGLR_anno_location$AsfixAnnoLocation.traverse(STRSGLR_anno_location.java:173) [java] at org.strategoxt.lang.compat.sglr.STRSGLR_anno_location$AsfixAnnoLocation.traverseArgs(STRSGLR_anno_location.java:152) [java] at org.strategoxt.lang.compat.sglr.STRSGLR_anno_location$AsfixAnnoLocation.traverse(STRSGLR_anno_location.java:173) [java] at org.strategoxt.lang.compat.sglr.STRSGLR_anno_location$AsfixAnnoLocation.traverseArgs(STRSGLR_anno_location.java:152) [java] at org.strategoxt.lang.compat.sglr.STRSGLR_anno_location$AsfixAnnoLocation.traverseArgs(STRSGLR_anno_location.java:153) [java] at org.strategoxt.lang.compat.sglr.STRSGLR_anno_location$AsfixAnnoLocation.traverseArgs(STRSGLR_anno_location.java:153) [java] at org.strategoxt.lang.compat.sglr.STRSGLR_anno_location$AsfixAnnoLocation.traverseArgs(STRSGLR_anno_location.java:153) [java] at org.strategoxt.lang.compat.sglr.STRSGLR_anno_location$AsfixAnnoLocation.traverseArgs(STRSGLR_anno_location.java:153) [java] at org.strategoxt.lang.compat.sglr.STRSGLR_anno_location$AsfixAnnoLocation.traverseArgs(STRSGLR_anno_location.java:153) [java] at org.strategoxt.lang.compat.sglr.STRSGLR_anno_location$AsfixAnnoLocation.traverseArgs(STRSGLR_anno_location.java:153) [java] at org.strategoxt.lang.compat.sglr.STRSGLR_anno_location$AsfixAnnoLocation.traverse(STRSGLR_anno_location.java:173) [java] at org.strategoxt.lang.compat.sglr.STRSGLR_anno_location$AsfixAnnoLocation.traverseArgs(STRSGLR_anno_location.java:152) [java] at org.strategoxt.lang.compat.sglr.STRSGLR_anno_location$AsfixAnnoLocation.traverse(STRSGLR_anno_location.java:173) [java] at org.strategoxt.lang.compat.sglr.STRSGLR_anno_location$AsfixAnnoLocation.traverseArgs(STRSGLR_anno_location.java:152) [java] at org.strategoxt.lang.compat.sglr.STRSGLR_anno_location$AsfixAnnoLocation.traverseArgs(STRSGLR_anno_location.java:153) [java] at org.strategoxt.lang.compat.sglr.STRSGLR_anno_location$AsfixAnnoLocation.traverse(STRSGLR_anno_location.java:173) [java] at org.strategoxt.lang.compat.sglr.STRSGLR_anno_location.annoLocation(STRSGLR_anno_location.java:49) [java] at org.strategoxt.lang.compat.sglr.STRSGLR_anno_location.call(STRSGLR_anno_location.java:42) [java] at org.strategoxt.lang.Context.invokePrimitive(Context.java:199) [java] ... 45 more [java] Fatal error at [java] webdslc_main_0_0 [java] xtc_io_wrap_5_0 [java] option_wrap_5_0 [java] xtc_io_1_0 [java] xtc_temp_files_1_0 [java] restore_always_2_0 [java] xtc_webdslc_0_0 [java] dsl_to_core_0_0 [java] dsl_to_core_analysis_0_0 [java] stage_1_1 [java] log_timed_1_1 [java] import_modules_0_0 [java] topdown_1_0 [java] topdown_1_0 [java] topdown_1_0 [java] topdown_1_0 [java] topdown_1_0 [java] try_1_0 [java] import_module_0_0 [java] xtc_parse_webdsl_module_0_0 [java] xtc_parse_webdsl_unit_0_1 [java] parse_and_write_cache_0_3 [java] implode_with_location_annos_0_1
BUILD FAILED
C:_tim\Workspaces\Studie\IN4308__\Gamestile\build.xml:9: The following error occurred while executing this line:
D:\Program Files\eclipse\plugins\webdsl.editor_1.0.0.201002091647\webdsl-template\webdsl-build-eclipse.xml:4: The following error occurred while executing this line:
D:\Program Files\eclipse\plugins\webdsl.editor_1.0.0.201002091647\webdsl-template\webdsl-build.xml:486: The following error occurred while executing this line:
D:\Program Files\eclipse\plugins\webdsl.editor_1.0.0.201002091647\webdsl-template\webdsl-build.xml:466: The following error occurred while executing this line:
D:\Program Files\eclipse\plugins\webdsl.editor_1.0.0.201002091647\webdsl-template\webdsl-build.xml:333: Java returned: 1Total time: 14 seconds
define page viewUser(u : User){
main( “User:” > u.fullname > “: " ){
table {
row{ “Name:” output(u.fullname)}
row{ “Nickname:” output(u.username) }
row{ “Date of Birth:” output(u.dateOfBirth) }
}
navigate(editUser(u)){”[Edit]"}
}
}define main(title: String) {
// …
}
@Tim: thanks for the stack trace. I fixed the bug in STRSGLR_anno_location (which should never fail like this).
The underlying cause for this failure seems to be an ambiguity in the WebDSL grammar though.
old issue
Log in to post comments