[Issue 20499] New: bad error message caused by UFCS attempt on the identifier matching to an import
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sat Jan 11 08:20:40 UTC 2020
https://issues.dlang.org/show_bug.cgi?id=20499
Issue ID: 20499
Summary: bad error message caused by UFCS attempt on the
identifier matching to an import
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Keywords: diagnostic
Severity: normal
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: b2.temp at gmx.com
a.d
---
module a;
class Foo
{
private int x;
}
---
---
module b;
import a;
void test(Foo foo)
{
foo.a++;
}
---
then in the same directory as the two files
$ dmd b.d
output:
> Error: function expected before `()`, not `module a` of type `void`
The real problem here is that `Foo` does not contain any member named a.
The bad message leads to think that the compiler tries a function `foo` on the
import `a`, i.e by UFCS but the only existing `foo` is a class.
Also if you look at the command line you can note that "a.d" is not specified.
I don't know why dmd automatically detects the file. If this is part of this
strange issue then what is expected is
> module `a` is in file 'a.d' which cannot be read
--
More information about the Digitalmars-d-bugs
mailing list