Skip to content

Commit

Permalink
[lang] In synthetic functions for default valued parameters, the retu…
Browse files Browse the repository at this point in the history
…rned type delegates to the original function's return type when it is inferred.

close #862

Signed-off-by: Stéphane Galland <galland@arakhne.org>
  • Loading branch information
gallandarakhneorg committed Sep 29, 2018
1 parent 81bf1af commit 30421ae
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
Expand Up @@ -128,6 +128,7 @@
import org.eclipse.xtext.xbase.typesystem.references.LightweightTypeReference;
import org.eclipse.xtext.xbase.typesystem.util.CommonTypeComputationServices;
import org.eclipse.xtext.xbase.validation.ReadAndWriteTracking;
import org.eclipse.xtext.xtype.XComputedTypeReference;

import io.sarl.lang.SARLVersion;
import io.sarl.lang.annotation.DefaultValue;
Expand Down Expand Up @@ -1808,14 +1809,11 @@ protected void transform(final XtendFunction source, final JvmGenericType contai
.cloneWithProxies(exception));
}

operation2.setReturnType(cloneWithTypeParametersAndProxies(selectedReturnType, operation2));
//operation2.setReturnType(this.typeReferences.createDelegateTypeReference(selectedReturnType));
/* FIXME: Remove if the line above works
if (selectedReturnType instanceof XComputedTypeReference) {
operation2.setReturnType(this.typeReferences.createDelegateTypeReference(selectedReturnType));
} else {
operation2.setReturnType(cloneWithTypeParametersAndProxies(selectedReturnType, operation2));
}*/
}

final List<String> args = translateSarlFormalParametersForSyntheticOperation(
operation2, container, isVarArgs, otherSignature.getValue());
Expand Down Expand Up @@ -3646,7 +3644,8 @@ protected JvmTypeReference inferFunctionReturnType(XtendFunction source, JvmOper
// An super operation was detected => reuse its return type.
if (overriddenOperation != null) {
final JvmTypeReference type = overriddenOperation.getReturnType();
return cloneWithProxiesFromOtherResource(type, target);
//return cloneWithProxiesFromOtherResource(type, target);
return this.typeReferences.createDelegateTypeReference(type);
}

// Return type is inferred from the operation's expression.
Expand Down
Expand Up @@ -343,14 +343,14 @@ public final EventListener asEventListener() {
*/
private class AgentEventListener implements EventListener {

private Queue<Event> buffer = Queues.newConcurrentLinkedQueue();

private final UUID aid;

/** Indicates if the agent has requested to be killed.
*/
final AtomicBoolean isKilled = new AtomicBoolean(false);

private Queue<Event> buffer = Queues.newConcurrentLinkedQueue();

private final UUID aid;

@SuppressWarnings("synthetic-access")
AgentEventListener() {
this.aid = InternalEventBusSkill.this.getOwner().getID();
Expand Down

0 comments on commit 30421ae

Please sign in to comment.