D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 14564 - [REG2.067] dmd -property -unittest combination causes compiler error
Summary: [REG2.067] dmd -property -unittest combination causes compiler error
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: phobos (show other issues)
Version: D2
Hardware: All All
: P1 regression
Assignee: ag0aep6g
URL:
Keywords: pull
Depends on:
Blocks:
 
Reported: 2015-05-10 04:38 UTC by Lucas Burson
Modified: 2015-08-25 09:44 UTC (History)
5 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Lucas Burson 2015-05-10 04:38:14 UTC
I see the below errors when compiling a simple file using -property -unittest argument combination. Using either one individually creates a functional binary.

A simple main.d:
import std.stdio;
void main()
{
    writeln("Hello world");
}



>dmd -property -unittest ./main.d
/usr/include/dmd/phobos/std/uni.d(5736): Error: not a property c.isWhite
/usr/include/dmd/phobos/std/uni.d(5738): Error: not a property a.map!(toLower)
/usr/include/dmd/phobos/std/uni.d(5738): Error: not a property map(a).filter!(pred)
/usr/include/dmd/phobos/std/uni.d(5739): Error: not a property b.map!(toLower)
/usr/include/dmd/phobos/std/uni.d(5739): Error: not a property map(b).filter!(pred)
/usr/include/dmd/phobos/std/uni.d(6028): Error: template instance std.uni.comparePropertyName!(char, char) error instantiating
/usr/include/dmd/phobos/std/algorithm/searching.d(1494):        instantiated from here: __lambda2!string
/usr/include/dmd/phobos/std/uni.d(6028):        instantiated from here: find!((x) => comparePropertyName(x, name) == 0, string[])
/usr/include/dmd/phobos/std/uni.d(6213):        instantiated from here: isPrettyPropertyName!char
/usr/include/dmd/phobos/std/uni.d(5897): Error: template std.uni.findUnicodeSet!(tab, char).findUnicodeSet.SortedRange!(MapResult!(unaryFun, immutable(UnicodeProperty)[]), __lambda2).SortedRange.lowerBound cannot deduce function from argument types !()(const(char[])), candidates are:
/usr/include/dmd/phobos/std/range/package.d(6942):        std.uni.findUnicodeSet!(tab, char).findUnicodeSet.SortedRange!(MapResult!(unaryFun, immutable(UnicodeProperty)[]), __lambda2).SortedRange.lowerBound(SearchPolicy sp = SearchPolicy.binarySearch, V)(V value) if (isTwoWayCompatible!(predFun, ElementType!Range, V) && hasSlicing!Range)
/usr/include/dmd/phobos/std/uni.d(6035): Error: template instance std.uni.findUnicodeSet!(tab, char) error instantiating
/usr/include/dmd/phobos/std/uni.d(6214):        instantiated from here: findSetName!(tab, char)
/usr/include/dmd/phobos/std/uni.d(5897): Error: template std.uni.findUnicodeSet!(tab, char).findUnicodeSet.SortedRange!(MapResult!(unaryFun, immutable(UnicodeProperty)[]), __lambda2).SortedRange.lowerBound cannot deduce function from argument types !()(const(char[])), candidates are:
/usr/include/dmd/phobos/std/range/package.d(6942):        std.uni.findUnicodeSet!(tab, char).findUnicodeSet.SortedRange!(MapResult!(unaryFun, immutable(UnicodeProperty)[]), __lambda2).SortedRange.lowerBound(SearchPolicy sp = SearchPolicy.binarySearch, V)(V value) if (isTwoWayCompatible!(predFun, ElementType!Range, V) && hasSlicing!Range)
/usr/include/dmd/phobos/std/uni.d(6035): Error: template instance std.uni.findUnicodeSet!(tab, char) error instantiating
/usr/include/dmd/phobos/std/uni.d(6214):        instantiated from here: findSetName!(tab, char)
/usr/include/dmd/phobos/std/uni.d(5897): Error: template std.uni.findUnicodeSet!(tab, char).findUnicodeSet.SortedRange!(MapResult!(unaryFun, immutable(UnicodeProperty)[]), __lambda2).SortedRange.lowerBound cannot deduce function from argument types !()(const(char[])), candidates are:
/usr/include/dmd/phobos/std/range/package.d(6942):        std.uni.findUnicodeSet!(tab, char).findUnicodeSet.SortedRange!(MapResult!(unaryFun, immutable(UnicodeProperty)[]), __lambda2).SortedRange.lowerBound(SearchPolicy sp = SearchPolicy.binarySearch, V)(V value) if (isTwoWayCompatible!(predFun, ElementType!Range, V) && hasSlicing!Range)
/usr/include/dmd/phobos/std/uni.d(6035): Error: template instance std.uni.findUnicodeSet!(tab, char) error instantiating
/usr/include/dmd/phobos/std/uni.d(6215):        instantiated from here: findSetName!(tab, char)
/usr/include/dmd/phobos/std/uni.d(6114):        called from here: findAny("Cyrillic")
/usr/include/dmd/phobos/std/uni.d(6117): Error: static assert  "No unicode set by name Cyrillic was found."
/usr/include/dmd/phobos/std/uni.d(2236):        instantiated from here: opDispatch!"Cyrillic"
/usr/include/dmd/phobos/std/uni.d(1853):        instantiated from here: InversionList!(GcPolicy)
Comment 1 Lucas Burson 2015-05-10 04:42:39 UTC
I forgot to note that the arg combination compiles using the previous version of dmd v2.066.1, and failure in v2.067.1.
Comment 2 ag0aep6g 2015-05-10 10:01:58 UTC
(In reply to Lucas Burson from comment #1)
> I forgot to note that the arg combination compiles using the previous
> version of dmd v2.066.1, and failure in v2.067.1.

Making this a regression.
Comment 3 Vladimir Panteleev 2015-05-13 21:13:14 UTC
-property is going away, but let's see what the maintainers say.

Introduced in https://github.com/D-Programming-Language/phobos/pull/2723
Comment 4 Илья Ярошенко 2015-05-14 01:15:46 UTC
(In reply to Vladimir Panteleev from comment #3)
> -property is going away, but let's see what the maintainers say.
> 
> Introduced in https://github.com/D-Programming-Language/phobos/pull/2723

Also introduced in std.uni (c.isWhite):

@trusted int comparePropertyName(Char1, Char2)(const(Char1)[] a, const(Char2)[] b)
{
    import std.ascii : toLower;
    import std.algorithm : cmp, map, filter;
    static bool pred(dchar c) {return !c.isWhite && c != '-' && c != '_';}
    return cmp(
        a.map!toLower.filter!pred,
        b.map!toLower.filter!pred);
}
Comment 5 Vladimir Panteleev 2015-05-14 01:17:55 UTC
(In reply to Илья Ярошенко from comment #4)
> Also introduced in

Please file that as a separate bug.
Comment 6 Илья Ярошенко 2015-05-14 01:30:38 UTC
I think it is the same bug because the error log by Lucas is about std.uni. If it would be decided that property syntax in Phobos should be fixed I'll fix both bugs.
Comment 7 Jonathan M Davis 2015-06-28 00:19:10 UTC
We should just change it so that -property does nothing (except maybe print that it's a defunct flag) so that no one's build process gets broken by its removal and so that we no longer have to care about it working.

We _were_ building Phobos with it to ensure that we weren't breaking anyone's code by writing code in templated functions which didn't work with -property, but clearly, we're not doing that anymore.

I think that we either need to be building with -property to ensure that we're not breaking folks code (and thus need to fix this regression), or we need to fix it so that -property does nothing so that there are no compilation errors related to -property.
Comment 8 Walter Bright 2015-07-11 23:37:39 UTC
(In reply to Vladimir Panteleev from comment #3)
> -property is going away, but let's see what the maintainers say.
> 
> Introduced in https://github.com/D-Programming-Language/phobos/pull/2723

Any idea which of those 196 lines produced the regression?
Comment 9 Илья Ярошенко 2015-07-12 03:45:43 UTC
(In reply to Walter Bright from comment #8)
> (In reply to Vladimir Panteleev from comment #3)
> > -property is going away, but let's see what the maintainers say.
> > 
> > Introduced in https://github.com/D-Programming-Language/phobos/pull/2723
> 
> Any idea which of those 196 lines produced the regression?

All lines with call `_ctfeSkipOp` or `_ctfeSkipInteger`.
Comment 10 Walter Bright 2015-07-21 23:35:32 UTC
(In reply to Илья Ярошенко from comment #9)
> (In reply to Walter Bright from comment #8)
> > Any idea which of those 196 lines produced the regression?
> 
> All lines with call `_ctfeSkipOp` or `_ctfeSkipInteger`.

So, the whole PR? Should we just revert it?
Comment 11 Илья Ярошенко 2015-07-22 06:30:15 UTC
(In reply to Walter Bright from comment #10)
> (In reply to Илья Ярошенко from comment #9)
> > (In reply to Walter Bright from comment #8)
> > > Any idea which of those 196 lines produced the regression?
> > 
> > All lines with call `_ctfeSkipOp` or `_ctfeSkipInteger`.
> 
> So, the whole PR? Should we just revert it?

Not only this PR! You need to revert half of Phobos if you want to fix this bug by reverting something.
For example, this is line in std.uni:

    static bool pred(dchar c) {return !c.isWhite && c != '-' && c != '_';}

The error (the first in this bug report) occurs because c.isWhite has not braces, not because my PR.

We need make the choice:
1. Remove -property option from compiler
OR
2. Add the -property option to the GitHub testing engine and fix ALL Phobos.
Comment 12 Jonathan M Davis 2015-07-22 20:15:58 UTC
(In reply to Илья Ярошенко from comment #11)
> We need make the choice:
> 1. Remove -property option from compiler
> OR
> 2. Add the -property option to the GitHub testing engine and fix ALL Phobos.

Exactly. And given that even if we want some type of property enforcement, the -property flag is enforcing something that we definitely _don't_ want at this point (that non-@property functions be called with parens), I think that we'd be better off to just remove -property. And presumably, that would mean making it do nothing to begin with rather than simply removing it, but we clearly don't want it, and it seems rather silly to be making a bunch of changes to Phobos at this point to support it (though arguably, whatever PR that removed the -property flag from the Phobos build shouldn't have been pulled as long as -property was still in the compiler, but it's a bit late for that now).

So, personally, I think that the clear choice is to make -property do nothing (except maybe print out a warning about how it now does nothing), but I don't know how much work that would be. Regardless, we have to get rid of it at some point, and if we don't do it now, we need to start building Phobos with -property, and make all of the changes associated with that.
Comment 13 ag0aep6g 2015-07-30 19:11:29 UTC
(In reply to Jonathan M Davis from comment #12)
> So, personally, I think that the clear choice is to make -property do
> nothing (except maybe print out a warning about how it now does nothing),
> but I don't know how much work that would be.

PR for that:
https://github.com/D-Programming-Language/dmd/pull/4850
Comment 15 github-bugzilla 2015-08-25 09:44:09 UTC
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/1e391e7b7a7a5d088811a7d5b145c783dfb4e356
make -property do nothing

fixes issue 14564 - [REG2.067] dmd -property -unittest combination causes
compiler error

Regarding the removed tests:

Issue 8629 occurred with other errors than property errors, too. It would
be possible to replace the property error with another one in the test.
But Martin Nowak says: "Just remove the test."

The test for issue 9241 was about the exact error message for when a
non-property is called without parentheses. That's allowed now, even with
-property. Removing the test.

https://github.com/D-Programming-Language/dmd/commit/05d132b4c15048fb988f6f498ce5ec4bfddb0512
Merge pull request #4862 from aG0aep6G/property-switch-2

issue 14564 - [REG2.067] dmd -property -unittest combination causes compiler error