D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 20756 - ImplicitConversionTargets ignores interface inheritance
Summary: ImplicitConversionTargets ignores interface inheritance
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: phobos (show other issues)
Version: D2
Hardware: All All
: P1 enhancement
Assignee: No Owner
URL:
Keywords: pull
Depends on:
Blocks:
 
Reported: 2020-04-21 11:40 UTC by FeepingCreature
Modified: 2021-04-27 14:11 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description FeepingCreature 2020-04-21 11:40:56 UTC
Repro:

interface A { }
interface B : A { }

static assert(is(ImplicitConversionTargets!B == AliasSeq!(A)));

Expected:

AliasSeq!(A)

Got:

AliasSeq!()

To add, TransitiveBaseTypeTuple (which ImplicitConversionTargets uses) also doesn't support interface parameters.
Comment 1 Dlang Bot 2020-04-21 11:43:48 UTC
@FeepingCreature created dlang/phobos pull request #7453 "Fix/issue 20756 implicitconversiontargets interfaces" fixing this issue:

- Fix issue 20756: support interfaces in ImplicitConversionTargets

https://github.com/dlang/phobos/pull/7453
Comment 2 Nathan S. 2020-05-24 15:57:47 UTC
Changed from 'bug' to 'enhancement' since the behavior of ImplicitConversionTargets is correct for its documentation:
```
    If the type is not a built-in value type or a class derived from
    `Object`, the an empty $(REF AliasSeq,std,meta) is returned.
```
Comment 3 FeepingCreature 2020-05-24 17:44:48 UTC
I would argue that then the documentation is another bug. A template called "ImplicitConversionTargets" can be reasonably expected to return implicit conversion targets.
Comment 4 Dlang Bot 2021-04-27 08:37:18 UTC
@FeepingCreature created dlang/phobos pull request #8016 "Fix issue 20756: Handle interface argument in `AllImplicitConversionTargets`." fixing this issue:

- Fix issue 20756: Handle interface argument in `AllImplicitConversionTargets`.

https://github.com/dlang/phobos/pull/8016
Comment 5 Dlang Bot 2021-04-27 11:42:12 UTC
dlang/phobos pull request #8016 "Fix issue 20756: Handle interface argument in `AllImplicitConversionTargets`." was merged into master:

- 3e619db79c6e4e33c2cf39de213f3a097e3d9951 by Mathis Beer:
  Fix issue 20756: Handle interface argument in `AllImplicitConversionTargets`.

https://github.com/dlang/phobos/pull/8016
Comment 6 FeepingCreature 2021-04-27 14:11:15 UTC
ImplicitConversionTargets has been deprecated. AllImplicitConversionTargets supports interface inheritance.