Skip to content
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

bug(forge): file import is not case sensitive when loading from cache #9958

Open
2 tasks done
18121A05L2 opened this issue Feb 26, 2025 · 2 comments
Open
2 tasks done
Labels
C-forge Command: forge T-bug Type: bug T-to-investigate Type: to investigate

Comments

@18121A05L2
Copy link

18121A05L2 commented Feb 26, 2025

Component

Forge

Have you ensured that all of these are up to date?

  • Foundry
  • Foundryup

What version of Foundry are you on?

1.0.0-nightly

What version of Foundryup are you on?

No output in my terminal

What command(s) is the bug in?

forge test and forge coverage

Operating System

macOS (Apple Silicon)

Describe the bug

in src file i have a GenesisNFTs.sol file , forge didn't throws error when import it with GenesisNfts like below

import {GenesisNFTs} from "../src/GenesisNfts.sol";

------------------------------------------ i have faced this issue because of the above --------------------------

There was no Two .sol files in the src , but forge was displaying two .sol test file as you can see in the image

Image

And also when i was doing forge inspect src/GenesisNFTs.sol:GenesisNFTs storage-layout

i was getting this error , as if you can see in the above image , there was only one GenesisNFTs.sol file and there was only one contract init

Error: Multiple contracts found with the name GenesisNFTs

@18121A05L2 18121A05L2 added T-bug Type: bug T-needs-triage Type: this issue needs to be labelled labels Feb 26, 2025
@github-project-automation github-project-automation bot moved this to Todo in Foundry Feb 26, 2025
@18121A05L2 18121A05L2 changed the title Duplicate Contract file Case sensitive imports Feb 26, 2025
@zerosnacks
Copy link
Member

Did this happen after you renamed the file? This can sometimes occur when moving files around due to cached artifacts.

Running forge clean should fix this

@zerosnacks zerosnacks added T-to-investigate Type: to investigate and removed T-needs-triage Type: this issue needs to be labelled labels Feb 26, 2025
@zerosnacks zerosnacks changed the title Case sensitive imports bug(forge): file import is not case sensitive when loading from cache Feb 26, 2025
@zerosnacks zerosnacks added the C-forge Command: forge label Feb 26, 2025
@18121A05L2
Copy link
Author

18121A05L2 commented Feb 26, 2025

Did this happen after you renamed the file? This can sometimes occur when moving files around due to cached artifacts.

Running forge clean should fix this

yes , because of renaming of the file

but i have tried doing forge clean around 5-10 times , and deleted the cache and out file , but this issue was still there

after i renamed the import path from import {GenesisNFTs} from "../src/GenesisNfts.sol"; to import {GenesisNFTs} from "../src/GenesisNFTs.sol"; then it fixed

But i feel this will be also issue right , like not showing error for an incorrect path as developers sometimes dont know where they did wrong and trying to figure it out , but that will take their time

any solutions for this to show the error for case sensitive imports like this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-forge Command: forge T-bug Type: bug T-to-investigate Type: to investigate
Projects
Status: Todo
Development

No branches or pull requests

2 participants