Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calculate proper common type of lambdas #17653

Open
dlangBugzillaToGithub opened this issue Apr 21, 2014 · 0 comments
Open

Calculate proper common type of lambdas #17653

dlangBugzillaToGithub opened this issue Apr 21, 2014 · 0 comments

Comments

@dlangBugzillaToGithub
Copy link

Kenji Hara (@9rnsr) reported this on 2014-04-21T04:08:24Z

Transferred from https://issues.dlang.org/show_bug.cgi?id=12605

Description

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)'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant