View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0037466 | Lazarus | IDE | public | 2020-08-02 12:27 | 2020-08-03 10:20 |
Reporter | nanobit | Assigned To | Mattias Gaertner | ||
Priority | normal | Severity | minor | Reproducibility | always |
Status | assigned | Resolution | open | ||
Platform | win32 | OS | Windows | ||
Product Version | 2.1 (SVN) | ||||
Summary | 0037466: IDE: wrong search-order for duplicate unit | ||||
Description | Wrong search-order in a project which contains duplicate unitnames: The IDE has a different search-order for unit than the compiler. Compiler search-order is: Projectfolder unit (eg. bugfixed unit) overrules units of other folders. Example of project structure: project\mainUnit.pas // contains "uses myUnit": IDE/FPC search in projectfolder project\myUnit.pas // bugfixed version project\shared\myOpenUnit.pas // contains "uses myUnit": FPC searches in projectfolder, IDE searches in sharedfolder project\shared\myUnit.pas // original version 1) In IDE, open a unit (mainUnit or myOpenUnit) which contains the text "uses myUnit". 2) IDE command "Find declaration of myUnit" should open the used "myUnit". 3) Wrong behavior: IDE searches at first in the folder of the open unit. Correct would be: IDE searches at first in the projectfolder. | ||||
Tags | No tags attached. | ||||
Fixed in Revision | 63675. | ||||
LazTarget | - | ||||
Widgetset | Win32/Win64 | ||||
Attached Files |
|
|
Thank you, but the command can still open the wrong myUnit.pas: Consider the following project\shared\myOpenUnit.pas: unit myOpenUnit; interface uses myUnit; .... Now, right-click on "myUnit" for contextmenu, then command "Find declaration of myUnit" opens this file: project\shared\myUnit.pas // but it should open this: project\myUnit.pas Should, because the compiler uses only this unit: project\myUnit.pas |
|
Tricky. If you would compile "fpc project\shared\myOpenUnit.pas" it would use project\shared\myUnit.pas. Basically, which myUnit.pas is used depends on which unit is loaded first by fpc, the project\mainUnit.pas or project\shared\myOpenUnit.pas. The IDE does not compile the project, it simply searches in the unit search path. This allows to ignore errors in other units and is much faster. Downside is that it works differently in some corner cases. That's why the IDE warns about ambiguous files when you compile. I don't see how to fix this easily. |
|
For the compiler, the locations of the referencing units are not relevant. For example, if the whole project contains only a single reference to myUnit: Only the file "project\shared\myOpenUnit.pas" contains the reference "uses myUnit;" The compiler still uses "project\myUnit.pas" only, and never "project\shared\myUnit.pas" The IDE cannot simply use the project search-paths (used by compiler)? I mean this order: First use the project search-paths (like the compiler does), and if the file is not found then use the folder of the referencing unit. |
|
No, fpc first searches in the already loaded units, then in the current directory of each unit and last in the unit path. Delphi does the same. |
Date Modified | Username | Field | Change |
---|---|---|---|
2020-08-02 12:27 | nanobit | New Issue | |
2020-08-02 16:26 | Mattias Gaertner | Assigned To | => Mattias Gaertner |
2020-08-02 16:26 | Mattias Gaertner | Status | new => assigned |
2020-08-02 18:27 | Mattias Gaertner | Status | assigned => resolved |
2020-08-02 18:27 | Mattias Gaertner | Resolution | open => fixed |
2020-08-02 18:27 | Mattias Gaertner | Fixed in Revision | => 63675. |
2020-08-02 18:27 | Mattias Gaertner | LazTarget | => - |
2020-08-02 18:27 | Mattias Gaertner | Widgetset | Win32/Win64 => Win32/Win64 |
2020-08-02 19:30 | nanobit | Note Added: 0124512 | |
2020-08-02 19:30 | nanobit | Note Edited: 0124512 | View Revisions |
2020-08-02 19:59 | Mattias Gaertner | Note Added: 0124515 | |
2020-08-03 09:36 | nanobit | Status | resolved => assigned |
2020-08-03 09:36 | nanobit | Resolution | fixed => open |
2020-08-03 09:36 | nanobit | Note Added: 0124523 | |
2020-08-03 10:08 | nanobit | Note Edited: 0124523 | View Revisions |
2020-08-03 10:17 | Mattias Gaertner | Note Added: 0124524 | |
2020-08-03 10:20 | Mattias Gaertner | Note Edited: 0124524 | View Revisions |