Having strange compiler issue with [async] and await

I created a new unit to contain a few classes for my WEB Core app. I've got several already. When I added it to one of my apps to start some testing, it started giving me compiler errors like this:

[Error] uScanManager.pas(243): await only available in async procedure

for EVERY single method that is tagged with [async] in front of it.

I've got dozens of similar methods, both procedures and functions, in other units, and they all compile and run fine.

This one has seemingly decided to refuse to allow the use of [async] on any of the methods!

I mean ... the compiler error is just plain WRONG! It's referring to lines that look like this:

str := await( myobj.DoThis( 'abcdef' ) );

INSIDE of methods that HAVE the [async] tag in front of them. I comment one out, and the next one shows up. When they're all commented out, I get no errors. Nothing will compile with await used anywhere!

Again, ALL of the methods with these errors DO HAVE [async] in front of their declarations!

I'm wondering if anybody else has run into that and what might be the cause.

I suspect there's a strange typo somewhere, or maybe it's an issue with ording in a uses clause. But I've got several smallish units just like this that implement different things and there's just not that much to go wrong.

WOW ... it turns out the problem was somehow caused because I had the unit in a folder with other common units, and the folder was added to the library search path. When I explicitly added the unit to the project, it compiles just fine.

I've run into this before, but not as strange.

So I guess the moral of the story is ... don't rely on using the library search path to find units, but rather add them to the project explicitly.

Is this a bug or known problem with the pas2js compiler or something else?

The [async] attribute is a TMS WEB Core specific language feature.
It requires that the units using it are part of the project for proper compilation.

hmmm ... I never realized that. Thanks.