hsutter / cppfront

A personal experimental C++ Syntax 2 -> Syntax 1 compiler
Other
5.24k stars 223 forks source link

fix(sema): skip scope only when the `using` shadows #965

Closed JohelEGP closed 5 months ago

JohelEGP commented 5 months ago

Resolves #962.

hsutter commented 5 months ago

Thanks!

I'm not sure this resolves #962 yet though?

prntln: (s: ::std::string) = {
  using ::std;
  cout << "A: (s)$" << endl;
}
JohelEGP commented 5 months ago

I changed the added unit test to

issue_962: (s: ::std::string) = {
  using ::std::string;
  std::cout << "A: (s)$" << std::endl;
}

adding ::string to using ::std::string; because using ::std; should have been using namespace ::std; but that doesn't reproduce. Also std::-qualified cout and endl.

hsutter commented 5 months ago

Aha, thanks. I was looking so much at the uses of s that didn't even notice that using ::std; wasn't legal, and the std:: qualifications were missing.

wolfseifert commented 5 months ago

Sorry for the wrong test case!

It was meant to be:

issue_962: (s: ::std::string) = {
  using ::std::cout;
  using ::std::endl;
  cout << "A: (s)$" << endl;
}
JohelEGP commented 5 months ago

By the way, thank you for the reports, @wolfseifert.