diff --git a/transpiler/src/test/java/org/jsweet/test/transpiler/AAARegressionTests.java b/transpiler/src/test/java/org/jsweet/test/transpiler/AAARegressionTests.java new file mode 100644 index 00000000..dfe18f3d --- /dev/null +++ b/transpiler/src/test/java/org/jsweet/test/transpiler/AAARegressionTests.java @@ -0,0 +1,37 @@ +/* + * JSweet - http://www.jsweet.org + * Copyright (C) 2015 CINCHEO SAS + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.jsweet.test.transpiler; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +import org.jsweet.transpiler.ModuleKind; +import org.junit.Ignore; +import org.junit.Test; + +import def.test.AmbientWithOverload; +import source.svregression.ExtendingIterableInterface; + +public class AAARegressionTests extends AbstractTest { + + @Test + public void testExtendingIterableInterface() { + transpile(ModuleKind.none, (logHandler) -> { + logHandler.assertNoProblems(); + }, getSourceFile(ExtendingIterableInterface.class)); + } +} diff --git a/transpiler/src/test/java/source/svregression/ExtendingIterableInterface.java b/transpiler/src/test/java/source/svregression/ExtendingIterableInterface.java new file mode 100644 index 00000000..e4dc845a --- /dev/null +++ b/transpiler/src/test/java/source/svregression/ExtendingIterableInterface.java @@ -0,0 +1,38 @@ + +package source.svregression; + +import java.util.List; +import java.util.ArrayList; +import java.util.Iterator; + +public class ExtendingIterableInterface { + public static void main(String[] args) { + WrappedList list = new WrappedListImpl(); // WrappedList interface inherits the iterable method, and yet... + for( int num : list ) { + System.out.println( num ); + } + } +} + +interface WrappedList extends Iterable { + + public void doSomething(); +} + +class WrappedListImpl implements WrappedList { + + private List nums = new ArrayList<>(); + + public WrappedListImpl() { + this.nums.add( 3 ); + this.nums.add( 5 ); + this.nums.add( 8 ); + } + + public Iterator iterator() { + return this.nums.iterator(); + } + + public void doSomething() { + } +}