-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is not yet specified does not work with overloads #666
Comments
I'll take a look at this. You mean this is an interpreter error, not an error with the code generator (you used the word "generated")? |
I take my previous comment back - I misread the model, sorry. |
I'm not sure I understand this issue. When the λ java -jar Overture-2.5.6.jar -vdmpp A.vdmpp -i
Parsed 1 class in 0.045 secs. No syntax errors
Type checked 1 class in 0.053 secs. No type errors
Initialized 1 class in 0.044 secs.
Interpreter started
> p bridge_SystemEnv`getenv("first", "second")
Error 4024: 'not yet specified' expression reached in 'bridge_SystemEnv' (A.vdmpp) at line 8:18
Stopped in 'bridge_SystemEnv' (A.vdmpp) at line 8:18
8: getenv(name)== is not yet specified;
[MainThread-3]> |
I think it may be a problem with what happens when there is a delegate Java class (here called bridge.SystemEnv) on the classpath? It may be that when it is working out what method of that class to call, it somehow deduces it is the outer two-param overload rather than the one param one. I need to create a small test Java class to try that out though... |
OK, I can reproduce this. You can force the error by calling a one-param function when there is a two-param overload. I suspect it is in the binding process in the Delegate class. Will investigate. This doesn't happen in VDMJ though. |
OK, as I suspected it is to do with the way that definitions are looked up and then bound to the class. It just happens to work in VDMJ because of the ordering; Overture has a FIXME about ordering, and just happens not to work. It should be fixable... I'll have a look later. |
I've just pushed a fix to ncb/development. It seems to work. Can someone else give it a try? |
Incidentally, the fix for this can't quite distinguish overloads as well as the type checker can. If you have two overloads with different parameter types, but the same parameter names and number of parameters, then you may still get problems. A workaround in this case is to rename the parameters so that they can be distinguished by name alone. To fix it so that we do a full type-checked comparison would be much more difficult (that information is tricky to get from the execution context). |
Fortunately, this situation is not that likely to occur anyway. Now that it's explained in the issue tracker, I think it's fine to consider this issue closed. |
Description
When this model show below is generated and the
getenv
method is implemented then the interpreter still complains that it cannot find:however it should never have searched for this method but the other one with only one argument.
[Description of the issue]
Steps to Reproduce
make the model and try to run it
Expected behavior: no error
Actual behavior: reports that it cannot find a method which is fully implemented in VDM
Reproduces how often: always
Versions
Version: 2.5.6
Build date: 2017 Dec 11 09:50 CET
Git commit description: Release/2.5.6
The text was updated successfully, but these errors were encountered: