Bug 19107 – -de produces compilation error, -dw does not

Status
RESOLVED
Resolution
FIXED
Severity
blocker
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86
OS
All
Creation time
2018-07-22T10:40:04Z
Last change time
2018-07-31T18:14:04Z
Assigned to
No Owner
Creator
Mike Franklin

Comments

Comment #0 by slavo5150 — 2018-07-22T10:40:04Z
--- sing.d module sing; alias I(alias A) = A; --- git.d import sing : I; --- manager.d module manager; import std.algorithm; import std.range; import git; class DManager { struct Config { struct Build { struct Components { string[] getEnabledComponentNames() { return null; } } Components components; } Build build; } Config config; void getCacheState(string[string] history) { auto componentNames = config.build.components.getEnabledComponentNames; auto components = componentNames.map!(componentName => componentName); components .map!(component => component) .map!(componentName => componentName); foreach (submoduleCommits; history) { componentNames.all!(componentName => componentName.I!(component => component)); } } } $ dmd -c -dw manager.d OK $ dmd -c -de manager.d manager.d(37): Error: template manager.DManager.getCacheState.__foreachbody5.all!((componentName) => componentName.I!((component) => component)).all cannot deduce function from argument types !()(string[]), candidates are: /usr/include/dlang/dmd/std/algorithm/searching.d(122): manager.DManager.getCacheState.__foreachbody5.all!((componentName) => componentName.I!((component) => component)).all(Range)(Range range) if (isInputRange!Range && is(typeof(unaryFun!pred(range.front)))) Currently blocking progress on https://github.com/dlang/dmd/pull/8443
Comment #1 by slavo5150 — 2018-07-25T18:07:35Z
Further reduced: --- sing.d module sing; alias I(alias A) = A; --- git.d import sing : I; --- manager.d module manager; import std.algorithm; import git; class DManager { void getCacheState(string[string] history) { string[] componentNames; foreach (submoduleCommits; history) { componentNames.all!(componentName => componentName.I!(component => component)); } } }
Comment #2 by slavo5150 — 2018-07-26T00:24:58Z
Further reduced to no longer require Phobos: --- sing.d module sing; alias I(alias A) = A; --- git.d import sing : I; --- manager.d module manager; import git; template all(alias pred = "a") { bool all(T)(T range) if (is(typeof(I!pred(range)))) { return false; } } class DManager { void getCacheState(string[] history) { string[] componentNames; foreach (submoduleCommits; history) { componentNames.all!(componentName => componentName.I!(component => component)); } } }
Comment #3 by slavo5150 — 2018-07-26T00:48:00Z
Even further reduced: --- sing.d module sing; alias I(alias A) = A; --- git.d import sing : I; --- manager.d module manager; import git; template all(alias pred) { void all(T)(T t) if (is(typeof(I!pred(t)))) { } } void main(string[] args) { args.all!(c => c); }
Comment #4 by github-bugzilla — 2018-07-31T18:14:03Z
Commits pushed to master at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/305f34e3ba8a46ba81e55c968c1da0f06fe3fe9e Fix Issue 19107 - -de produces compilation error, -dw does not https://github.com/dlang/dmd/commit/03e7693150c453055b098768e59ebd31cb3ca52e Merge pull request #8519 from JinShil/fix_19107 Fix Issue 19107 - -de produces compilation error, -dw does not