Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 356802

Summary: query name lookup failure across modules
Product: [Modeling] Acceleo Reporter: Vlad Gheorghe <vlad.gheorghe>
Component: CoreAssignee: Project Inbox <acceleo-inbox>
Status: CLOSED FIXED QA Contact:
Severity: major    
Priority: P3 CC: stephane.begaudeau
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: All   
Whiteboard:
Attachments:
Description Flags
test Acceleo project "tst.acceleo.bugNameResolution" none

Description Vlad Gheorghe CLA 2011-09-06 08:20:49 EDT
Build Identifier: Acceleo SDK	3.1.0.v20110607-0602

In a project with multiple modules, trying to call in a module a query defined in another module sometimes fails with a compile error "Cannot find operation ...".

main::generate
main::p2::A
main::p2::B

It might be related to the query argument/return type being a collection type  Sequence(T).



Reproducible: Sometimes

Steps to Reproduce:
1. import attached project tst.acceleo.bugNameResolution
2. Compile errors in Problems view:
Description	Resource	Path	Location	Type
Cannot find operation (q1A(String)) for the type (String)	generate.mtl	/tst.acceleo.bugNameResolution/src/tst/acceleo/bugNameResolution/main	line 48	Acceleo Problem
Cannot find operation (q2A()) for the type (Sequence(String))	generate.mtl	/tst.acceleo.bugNameResolution/src/tst/acceleo/bugNameResolution/main	line 24	Acceleo Problem

Note: For all the similar errors that have been observed during testing, the respective lines are marked with "[comment ERROR/]". 
However, not all these errors seem reproducible.
Comment 1 Vlad Gheorghe CLA 2011-09-06 08:23:09 EDT
Created attachment 202798 [details]
test Acceleo project "tst.acceleo.bugNameResolution"
Comment 2 Stephane Begaudeau CLA 2011-09-07 11:21:56 EDT
Thanks for your report, it helped me to find (one more) a condition that can trigger this problem.

If you have an operation name 'A' that takes a String as a parameter, we have to ways to see this operation. We can see it as an operation that applies on a String and which takes no parameter, or we can see it as an operation that applies on "nothing" and which takes a String as a parameter. If OCL encounter the version which applies on a String, it will compare what it is looking for 'A' which takes a String as a parameter and by comparing the number of argument (0 against 1) it will conclude that the two operations do not match. After having tried all the operation, OCL will conclude by saying that the operation was not found.

I still haven't found the condition that change between the "it works" and it doesn't work" (I'll see that tomorrow but I believe that "sometimes we may not have the two signatures available") but we are currently in progress to overwrite this OCL mechanism (AbstractTypeChecker#findOperationMatching(...)) by one of our own in order to improve performances during the operation signatures resolution, which is critical for us, so this mechanism will be improved soon.

I'll comment on this bug again to report my findings.

Stephane Begaudeau
Comment 3 Stephane Begaudeau CLA 2012-04-20 04:09:21 EDT
Now, in Acceleo 3.3.0 it compiles and run nicely, I believe this issue was related to this bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=365912

Screenshot of the result: https://plus.google.com/photos/105625286543794908607/albums/5552047126204483729/5733391692595659506?utm_source=chrome_ntp_icon&utm_medium=chrome_app&utm_campaign=chrome
Comment 4 Laurent Goubet CLA 2015-05-27 08:56:14 EDT
Closing resolved bugs