mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-03-01 18:13:18 +01:00
Fixed lambda inference
This commit is contained in:
@@ -5197,6 +5197,11 @@ Expression *FuncExp::inferType(Scope *sc, Type *to)
|
||||
sc = scope;
|
||||
}
|
||||
|
||||
#if IN_LLVM
|
||||
if (fd->tok == TOKreserved && to->ty == Tpointer && to->nextOf()->ty == Tfunction)
|
||||
fd->tok = TOKfunction;
|
||||
#endif
|
||||
|
||||
Expression *e = NULL;
|
||||
if (td)
|
||||
{ /// Parameter types inference from
|
||||
|
||||
@@ -5306,6 +5306,15 @@ void TypeFunction::toDecoBuffer(OutBuffer *buf, int flag, bool mangle)
|
||||
buf->writeByte('M');
|
||||
ad->type->toDecoBuffer(buf, 0, false);
|
||||
}
|
||||
if (FuncLiteralDeclaration *literal = funcdecl->isFuncLiteralDeclaration()) {
|
||||
// Never merge types of function literals of different kind
|
||||
if (literal->tok == TOKreserved)
|
||||
buf->writeByte('L');
|
||||
else if (literal->tok == TOKfunction)
|
||||
buf->writeByte('F');
|
||||
else if (literal->tok == TOKdelegate)
|
||||
buf->writeByte('D');
|
||||
}
|
||||
/* BUG This causes problems with delegate types
|
||||
On the other hand, the llvm type for nested functions *is* different
|
||||
so not doing anything here may be lead to bugs!
|
||||
|
||||
Reference in New Issue
Block a user