[Issue 12605] New: Calculate proper common type of lambdas
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Sun Apr 20 21:08:24 PDT 2014
https://issues.dlang.org/show_bug.cgi?id=12605
Issue ID: 12605
Summary: Calculate proper common type of lambdas
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: enhancement
Priority: P1
Component: DMD
Assignee: nobody at puremagic.com
Reporter: k.hara.pg at gmail.com
Currently this code:
pragma(msg, typeof(true ? (x => x) : ((int x) => x * 2)));
prints 'void'. But it could print 'int function(int)' by fitting parameter
types.
More cases:
pragma(msg, typeof(true ? (()=>1) : (()=>1.0)));
// fitting return types - could be 'double function()'
pragma(msg, typeof(true ? ((int x) => 1) : (delegate(int x)=>1)));
// fitting context type --> could be 'int delegate(int)'
--
More information about the Digitalmars-d-bugs
mailing list