Page 1 of 1

Consistent import

PostPosted: Sat Feb 09, 2019 9:42 pm
by DGDanforth
Folks,

When compiling an old module I got the error message
" MyVectors.Vector is not consistently imported
"
but that does not tell me which modules are inconsistent.

It would be very nice if a list (or tree?) were presented showing
the inconsistent modules.

Doug

Re: Consistent import

PostPosted: Sun Feb 10, 2019 12:37 pm
by Josef Templ
If the imports are processed in textual order, I assume so but I have not checked it, then move the import that produces the inconsistency to the start of the import list. Then compile again and see which module produces the message now. That is the module you are looking for.

- Josef

Re: Consistent import

PostPosted: Mon Feb 11, 2019 12:36 am
by DGDanforth
Josef Templ wrote:If the imports are processed in textual order, I assume so but I have not checked it, then move the import that produces the inconsistency to the start of the import list. Then compile again and see which module produces the message now. That is the module you are looking for.

- Josef

"move the import that produces the inconsistency"
But I don't know which import produces the inconsistency!
When I compile module A which has an import list L the compiler
just says module X is inconsistently imported.
Do you mean to move module X to the head of the import list?
Well, in my case X does not occur within L. It is imported
by some subset of the modules in L.

Doug

Re: Consistent import

PostPosted: Mon Feb 11, 2019 1:14 am
by cfbsoftware
You can use Info > Dependency to draw a dependency graph and Info > Create Tool to generate a set of commands to recompile everything in the correct order.

However, as far as I can see, these commands require object files :( . As your top-level module fails to compile you might need to create a tool for each item in your import list and run each of those tools to perform recompiles of the lower level modules first.

Re: Consistent import

PostPosted: Mon Feb 11, 2019 5:01 pm
by Josef Templ
I see, the error position is not very specific.
This is because for some reason the compiler checks for inconsistencies not
during the import but only later on before creating an object file.
But there is another approach that really works.

Comment out all the code of your module except for the import statement.
Recompile. Should not produce any error message now.
Then, try to load this module by executing some dummy procedure (that does not exist).
The loading will fail with an inconsistency message that reads like this:

command error: object A.R inconsistently imported from B

Then you know that you have to recompile B.

Hope this helps.

- Josef

Re: Consistent import

PostPosted: Tue Feb 12, 2019 2:26 am
by DGDanforth
Josef Templ wrote:I see, the error position is not very specific.
This is because for some reason the compiler checks for inconsistencies not
during the import but only later on before creating an object file.
But there is another approach that really works.

Comment out all the code of your module except for the import statement.
Recompile. Should not produce any error message now.
Then, try to load this module by executing some dummy procedure (that does not exist).
The loading will fail with an inconsistency message that reads like this:

command error: object A.R inconsistently imported from B

Then you know that you have to recompile B.

Hope this helps.

- Josef

Unfortunately that is not what I see. Here is a screen dump of what the
compiler produces after the body text has been folded out

Re: Consistent import

PostPosted: Tue Feb 12, 2019 11:47 am
by Robert
There is a module, on CPC, called WandsTracer, that can analyze import lists, and generate compile lists.

A full recursive report of all imports, including the Oms modules, can be very large! However if you just ask for the compile list excluding Oms modules the report is quite reasonable. I show below the import dependancies for WandsTracer itself.

Re: Consistent import

PostPosted: Wed Feb 13, 2019 1:40 am
by DGDanforth
Robert wrote:There is a module, on CPC, called WandsTracer, that can analyze import lists, and generate compile lists.

A full recursive report of all imports, including the Oms modules, can be very large! However if you just ask for the compile list excluding Oms modules the report is quite reasonable. I show below the import dependancuies for WandsTracer itself.


Thank you Robert. I'll look at it.

Doug

Re: Consistent import

PostPosted: Wed Feb 13, 2019 4:42 pm
by Josef Templ
In some situations (public fingerprint changed) the compiler emits the error message right at the module import.
In other situations (only the private fingerprint changed, e.g. by adding or removing a non-exported field from
an exported type) the error message is delayed until that object (typically a type) is really used and there is no meaningful position.
In any case there is also some info displayed in the LOG window.
This should give you an idea where the inconsistency comes from. What is written to the log?.
In your case the module that causes the inconsistency is MyViews. Some type may have been changed and
that type should be listed in the log.
It may be enough to recompile MyViews.

- Josef

Re: Consistent import

PostPosted: Thu Feb 14, 2019 12:08 pm
by Robert
Robert wrote:I show below the import dependancies for WandsTracer itself.

This listing was generated by setting up the control Form as shown below. (Other sets of control options can produce very long lists!)

Tracer.png
Tracer Form
Tracer.png (7.37 KiB) Viewed 4642 times