Skip to content

Commit

Permalink
[lang] Proper detection of the method overriding with parameters of f…
Browse files Browse the repository at this point in the history
…unction type.

close #739

Signed-off-by: Stéphane Galland <galland@arakhne.org>
  • Loading branch information
gallandarakhneorg committed Sep 5, 2017
1 parent c401000 commit eac8397
Show file tree
Hide file tree
Showing 196 changed files with 668 additions and 619 deletions.
Expand Up @@ -53,7 +53,7 @@

import io.sarl.lang.SARLStandaloneSetup;
import io.sarl.lang.SARLVersion;
import io.sarl.lang.compilation.compiler.batch.SarlBatchCompiler;
import io.sarl.lang.compiler.batch.SarlBatchCompiler;
import io.sarl.tests.api.AbstractSarlTest;

/** Class for testing the examples.
Expand Down
Expand Up @@ -29,7 +29,7 @@
import org.eclipse.xtext.generator.IOutputConfigurationProvider;
import org.eclipse.xtext.generator.OutputConfiguration;

import io.sarl.lang.compilation.generator.extra.ExtraLanguageOutputConfigurations;
import io.sarl.lang.compiler.extra.ExtraLanguageOutputConfigurations;
import io.sarl.pythongenerator.PyGeneratorPlugin;
import io.sarl.pythongenerator.generator.Messages;

Expand Down
Expand Up @@ -26,8 +26,8 @@
import org.eclipse.xtext.ui.editor.preferences.IPreferenceStoreAccess;
import org.eclipse.xtext.ui.editor.preferences.IPreferenceStoreInitializer;

import io.sarl.lang.compilation.generator.extra.IExtraLanguageConversionInitializer;
import io.sarl.lang.ui.compilation.generator.extra.preferences.ExtraLanguagePreferenceAccess;
import io.sarl.lang.compiler.extra.IExtraLanguageConversionInitializer;
import io.sarl.lang.ui.compiler.extra.preferences.ExtraLanguagePreferenceAccess;
import io.sarl.pythongenerator.PyGeneratorPlugin;
import io.sarl.pythongenerator.generator.PyInitializers;

Expand Down
Expand Up @@ -21,9 +21,9 @@

package io.sarl.pythongenerator.generator;

import io.sarl.lang.compilation.generator.extra.ExtraLanguageAppendable;
import io.sarl.lang.compilation.generator.extra.ExtraLanguageImportManager;
import io.sarl.lang.compilation.generator.extra.ExtraLanguageTypeConverter;
import io.sarl.lang.compiler.extra.ExtraLanguageAppendable;
import io.sarl.lang.compiler.extra.ExtraLanguageImportManager;
import io.sarl.lang.compiler.extra.ExtraLanguageTypeConverter;

/** Appendable dedicated to Python.
*
Expand Down
Expand Up @@ -70,10 +70,10 @@
import org.eclipse.xtext.xbase.typesystem.references.FunctionTypeReference;
import org.eclipse.xtext.xbase.typesystem.references.LightweightTypeReference;

import io.sarl.lang.compilation.generator.extra.AbstractExpressionGenerator;
import io.sarl.lang.compilation.generator.extra.IExtraLanguageConversionInitializer;
import io.sarl.lang.compilation.generator.extra.IExtraLanguageGeneratorContext;
import io.sarl.lang.compilation.generator.extra.IRootGenerator;
import io.sarl.lang.compiler.extra.AbstractExpressionGenerator;
import io.sarl.lang.compiler.extra.IExtraLanguageConversionInitializer;
import io.sarl.lang.compiler.extra.IExtraLanguageGeneratorContext;
import io.sarl.lang.compiler.extra.IRootGenerator;
import io.sarl.lang.sarl.SarlAssertExpression;
import io.sarl.lang.sarl.SarlBreakExpression;
import io.sarl.pythongenerator.PyGeneratorPlugin;
Expand Down Expand Up @@ -992,7 +992,7 @@ private void appendCallPrefix(Collection<?> elements, String postfix) {
@Override
protected void appendCall(JvmIdentifiableElement calledFeature, List<Object> leftOperand,
List<Object> receiver, String name,
List<XExpression> args, Function0<XExpression> beginOfBlock) {
List<XExpression> args, Function0<? extends XExpression> beginOfBlock) {
if (beginOfBlock != null) {
this.codeReceiver.append("if "); //$NON-NLS-1$
PyExpressionGenerator.this.generate(beginOfBlock.apply(), this.codeReceiver, this.context);
Expand Down
Expand Up @@ -53,10 +53,10 @@
import org.eclipse.xtext.xbase.lib.Procedures.Procedure2;
import org.eclipse.xtext.xbase.typesystem.references.LightweightTypeReference;

import io.sarl.lang.compilation.generator.extra.AbstractExtraLanguageGenerator;
import io.sarl.lang.compilation.generator.extra.ExtraLanguageAppendable;
import io.sarl.lang.compilation.generator.extra.ExtraLanguageTypeConverter;
import io.sarl.lang.compilation.generator.extra.IExtraLanguageGeneratorContext;
import io.sarl.lang.compiler.extra.AbstractExtraLanguageGenerator;
import io.sarl.lang.compiler.extra.ExtraLanguageAppendable;
import io.sarl.lang.compiler.extra.ExtraLanguageTypeConverter;
import io.sarl.lang.compiler.extra.IExtraLanguageGeneratorContext;
import io.sarl.lang.core.Agent;
import io.sarl.lang.core.Behavior;
import io.sarl.lang.core.Capacity;
Expand Down Expand Up @@ -266,7 +266,7 @@ protected boolean generatePythonClassDeclaration(String typeName, boolean isAbst
*/
protected boolean generateTypeDeclaration(String name, boolean isAbstract,
List<? extends JvmTypeReference> superTypes, boolean ignoreObjectType, List<? extends XtendMember> members, PyAppendable it,
IExtraLanguageGeneratorContext context, Procedure2<PyAppendable, IExtraLanguageGeneratorContext> memberGenerator) {
IExtraLanguageGeneratorContext context, Procedure2<? super PyAppendable, ? super IExtraLanguageGeneratorContext> memberGenerator) {
if (!Strings.isEmpty(name)) {
if (!generatePythonClassDeclaration(name, isAbstract, superTypes, ignoreObjectType, it, context)
|| context.getCancelIndicator().isCanceled()) {
Expand Down
Expand Up @@ -25,7 +25,7 @@

import com.google.inject.Injector;

import io.sarl.lang.ui.compilation.generator.extra.AbstractExtraLanguageGeneratorProvider;
import io.sarl.lang.ui.compiler.extra.AbstractExtraLanguageGeneratorProvider;
import io.sarl.pythongenerator.PyGeneratorPlugin;

/** Provider the Python generator if is it enabled.
Expand Down
Expand Up @@ -36,7 +36,7 @@
import org.eclipse.core.runtime.Path;
import org.eclipse.xtext.xbase.lib.Pair;

import io.sarl.lang.compilation.generator.extra.IExtraLanguageConversionInitializer;
import io.sarl.lang.compiler.extra.IExtraLanguageConversionInitializer;
import io.sarl.pythongenerator.PyGeneratorPlugin;

/** Initializers for Python 3.
Expand Down
Expand Up @@ -24,7 +24,7 @@
import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.swt.graphics.Image;

import io.sarl.lang.ui.compilation.generator.extra.properties.AbstractGeneratorConfigurationBlock;
import io.sarl.lang.ui.compiler.extra.properties.AbstractGeneratorConfigurationBlock;
import io.sarl.pythongenerator.PyGeneratorPlugin;

/** Configuration block for the Python generator.
Expand Down
Expand Up @@ -23,7 +23,7 @@

import com.google.inject.Inject;

import io.sarl.lang.ui.compilation.generator.extra.properties.AbstractExtraLanguagePropertyPage;
import io.sarl.lang.ui.compiler.extra.properties.AbstractExtraLanguagePropertyPage;
import io.sarl.pythongenerator.PyGeneratorPlugin;

/** Property page for configuring the Python generator.
Expand Down
Expand Up @@ -43,7 +43,7 @@
import org.eclipse.xtext.xtype.XImportDeclaration;
import org.eclipse.xtext.xtype.XtypePackage;

import io.sarl.lang.compilation.generator.extra.IExtraLanguageConversionInitializer;
import io.sarl.lang.compiler.extra.IExtraLanguageConversionInitializer;
import io.sarl.lang.validation.extra.AbstractExtraLanguageValidator;
import io.sarl.pythongenerator.PyGeneratorPlugin;
import io.sarl.pythongenerator.generator.PyInitializers;
Expand All @@ -61,21 +61,21 @@ public class PyValidator extends AbstractExtraLanguageValidator {

/** Error handler for the type conversions.
*/
private final Procedure3<EObject, JvmType, String> typeErrorHandler1 = (source, invalidType, name) -> {
private final Procedure3<? super EObject, ? super JvmType, ? super String> typeErrorHandler1 = (source, invalidType, name) -> {
error(MessageFormat.format(Messages.PyValidator_0, name), source,
XtypePackage.eINSTANCE.getXImportDeclaration_ImportedType());
};

/** Error handler for the type conversions.
*/
private final Procedure3<EObject, JvmType, String> typeErrorHandler2 = (source, invalidType, name) -> {
private final Procedure3<? super EObject, ? super JvmType, ? super String> typeErrorHandler2 = (source, invalidType, name) -> {
error(MessageFormat.format(Messages.PyValidator_0, name), source,
XbasePackage.eINSTANCE.getXAbstractFeatureCall_Feature());
};

/** Error handler for the feature conversions.
*/
private final Function2<EObject, JvmIdentifiableElement, Boolean> featureErrorHandler = (source, element) -> {
private final Function2<? super EObject, ? super JvmIdentifiableElement, ? extends Boolean> featureErrorHandler = (source, element) -> {
final String message;
if (element instanceof JvmConstructor) {
message = MessageFormat.format(Messages.PyValidator_1, this.simpleNameProvider.getSimpleName(element));
Expand Down
Expand Up @@ -2,7 +2,7 @@

[:Outline:]

[:Fact:]{(io.sarl.lang.compilation.compiler.batch.Main)::getCompilerProgramName == '[:name](sarlc)'}
[:Fact:]{(io.sarl.lang.compiler.batch.Main)::getCompilerProgramName == '[:name](sarlc)'}

A command-line compiler is a tool that could be invoked from the command-line shell in order to compiler a language source file.
[:name:] is the command-line compiler for the SARL language.
Expand Down Expand Up @@ -33,7 +33,7 @@ The complete list of the options is:
| Option | Description |
| ------ | ----------- |
[:Dynamic:]{
io.sarl.lang.compilation.compiler.batch.Main::getOptions.renderToMarkdown
io.sarl.lang.compiler.batch.Main::getOptions.renderToMarkdown
}


Expand Down
2 changes: 1 addition & 1 deletion formatting-styles/latex/sarl-beamer-listing.sty
Expand Up @@ -22,7 +22,7 @@
% limitations under the License.
%
\NeedsTeXFormat{LaTeX2e}[1995/12/01]
\ProvidesPackage{sarl-beamer-listing}[2017/08/27]
\ProvidesPackage{sarl-beamer-listing}[2017/09/05]
\newif\ifusesarlcolors\usesarlcolorstrue
\DeclareOption{sarlcolors}{\global\usesarlcolorstrue}
\DeclareOption{nosarlcolors}{\global\usesarlcolorsfalse}
Expand Down
2 changes: 1 addition & 1 deletion formatting-styles/latex/sarl-colorized-listing.sty
Expand Up @@ -22,7 +22,7 @@
% limitations under the License.
%
\NeedsTeXFormat{LaTeX2e}[1995/12/01]
\ProvidesPackage{sarl-colorized-listing}[2017/08/27]
\ProvidesPackage{sarl-colorized-listing}[2017/09/05]
\newif\ifusesarlcolors\usesarlcolorstrue
\DeclareOption{sarlcolors}{\global\usesarlcolorstrue}
\DeclareOption{nosarlcolors}{\global\usesarlcolorsfalse}
Expand Down
2 changes: 1 addition & 1 deletion formatting-styles/latex/sarl-listing.sty
Expand Up @@ -22,7 +22,7 @@
% limitations under the License.
%
\NeedsTeXFormat{LaTeX2e}[1995/12/01]
\ProvidesPackage{sarl-listing}[2017/08/27]
\ProvidesPackage{sarl-listing}[2017/09/05]
\newif\ifusesarlcolors\usesarlcolorstrue
\DeclareOption{sarlcolors}{\global\usesarlcolorstrue}
\DeclareOption{nosarlcolors}{\global\usesarlcolorsfalse}
Expand Down
Expand Up @@ -86,7 +86,7 @@
import io.sarl.lang.core.Agent;
import io.sarl.lang.sarl.SarlAgent;
import io.sarl.lang.sarl.SarlScript;
import io.sarl.lang.ui.info.images.SARLImages;
import io.sarl.lang.ui.labeling.SARLImages;

/** Shortcut for launching a SARL agent.
*
Expand Down
Expand Up @@ -1213,8 +1213,8 @@ private static void createInfoCall(IExpressionBuilder builder, String message) {
* @since 0.5
*/
protected boolean createStandardSARLEventTemplates(String elementTypeName,
Function1<String, ISarlBehaviorUnitBuilder> behaviorUnitAdder,
Procedure1<String> usesAdder) {
Function1<? super String, ? extends ISarlBehaviorUnitBuilder> behaviorUnitAdder,
Procedure1<? super String> usesAdder) {
if (!isCreateStandardEventHandlers()) {
return false;
}
Expand Down Expand Up @@ -1295,8 +1295,8 @@ protected boolean createStandardSARLEventTemplates(String elementTypeName,
* @since 0.5
*/
protected boolean createStandardSARLLifecycleFunctionTemplates(String elementTypeName,
Function1<String, ISarlActionBuilder> actionAdder,
Procedure1<String> usesAdder) {
Function1<? super String, ? extends ISarlActionBuilder> actionAdder,
Procedure1<? super String> usesAdder) {
if (!isCreateStandardLifecycleFunctions()) {
return false;
}
Expand Down
Expand Up @@ -32,7 +32,7 @@
import org.eclipse.xtext.naming.QualifiedName;
import org.eclipse.xtext.util.Strings;

import io.sarl.lang.ui.info.images.IQualifiedNameImageProvider;
import io.sarl.lang.ui.labeling.IQualifiedNameImageProvider;

/** Extension for the type selector.
*
Expand Down
Expand Up @@ -191,7 +191,7 @@ protected final <S extends Skill> S setSkill(S skill, Class<? extends Capacity>.
return skill;
}

private static void runOnImplementedCapacities(Skill skill, Procedure1<Class<? extends Capacity>> callback) {
private static void runOnImplementedCapacities(Skill skill, Procedure1<? super Class<? extends Capacity>> callback) {
TypeToken.of(skill.getClass()).getTypes().interfaces().stream().parallel().forEach((it) -> {
final Class<?> type = it.getRawType();
if (Capacity.class.isAssignableFrom(type) && !Capacity.class.equals(type)) {
Expand Down
Expand Up @@ -62,6 +62,6 @@ default Map<Class<? extends Capacity>, Skill> getBuiltinCapacities(Agent agent)
* The first argument is the agent. The second
* argument is the builtin capacity. The third argument is the skill instance.
*/
void builtinCapacities(Agent agent, Procedure2<Class<? extends Capacity>, Skill> skillMappingCallback);
void builtinCapacities(Agent agent, Procedure2<? super Class<? extends Capacity>, ? super Skill> skillMappingCallback);

}

0 comments on commit eac8397

Please sign in to comment.