
Olaf Chitil
The problem is that qualified names are not handled correctly and sometimes are confused with unqualified names.
So the problem is in the auxLabelSyntaxTree part. So I'd like to pass the problem back to Malcolm. Or I'll have to see tomorrow how this part works.
Ah, I must accept responsibility. The comment in this piece of code particularly sums up the situation:
lookEnv :: Environment -> TokenId -> TraceId lookEnv env id = case useEnvironment env id of Just info -> id `plus` info _ -> case id of -- this is a horrible hack to by-pass qualified names. Qualified _ x -> case useEnvironment env (Visible x) of ....
Thus, at lookup-time, if the qualified name does not resolve, we pretend it is an unqualified name. In fact, the problem lies further back than the AST-relabelling phase. It is during import resolution (in AuxFile) that we are failing to store the qualified variable names into the environment in the first place. I have attempted a solution, to store both qualified/unqualified variants of names into the environment (as appropriate, given the import decls). So far, it doesn't work, but I am too tired to investigate further tonight. I can send you the diffs if you want to look at it yourself...? Regards, Malcolm