Bug 15774 – cant write import std.range; twice

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2016-03-06T13:00:49Z
Last change time
2018-03-04T17:05:27Z
Assigned to
No Owner
Creator
Johannes Nordhoff

Comments

Comment #0 by mephisto — 2016-03-06T13:00:49Z
import std.range; public struct myRng( E) { import std.range; public: @property E front() { return 0; } @property void front( int elem) { } void popFront() { } @property bool empty() { return true; } @property auto save() { return this; } } static assert( isForwardRange!( myRng!int)); bool check_( SomeThing)( SomeThing fofo) if( isInputRange!SomeThing) { return is( fofo); } unittest { auto r = myRng!int(); assert( r.check_ == false); assert( walkLength( r) == 0); assert( r.walkLength == 1); // here the compiler fails }$ $ $ $ $ $ dmd --version | fgrep -i dmd DMD64 D Compiler v2.070.1 $ $ $ $ dmd t.d -lib -unittest t.d(38): Error: cannot resolve type for r.walkLength(Range)(Range range) if (isInputRange!Range && !isInfinite!Range) $ cant write import std.range; twice in that situation. its not okay, because with "mixin template" i have to write it twice sometimes. (the compiler complains, if i dont write the imports into the mixins. i dont even know, if that is correct behaviour)
Comment #1 by mephisto — 2016-03-07T09:36:44Z
okay, after looking at it once more i noticed i actually dont have to write the "import" twice. i failed at that point
Comment #2 by ag0aep6g — 2018-03-04T17:05:27Z
Test case compiles since 2.071.2: <https://run.dlang.io/is/7cTbWh>. Closing as FIXED.