managed-commons / stab-language

Automatically exported from code.google.com/p/stab-language
Apache License 2.0
5 stars 3 forks source link

Writing two extension methods with the same name #3

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
It should not be possible to write two extension methods with the same name. 
The following code:

using java.lang;
using stab.lang;

package examples {

    [StaticClass]
    public class Strings {

        [ExtensionMethod]
        public static String capitalize(String s) {
            return "Strings";
        }
    }

    [StaticClass]
    public class StringUtil {

        [ExtensionMethod]
        public static String capitalize(String s) {
            return "StringUtil";
        }
    }

    public class Main {
        public static void main(String[] args) {
            String s = "ssss";
            System.out.println(s.capitalize());
        }
    }

}

returns "Strings", but it should terminate with a compiler error.

Original issue reported on code.google.com by ice.ta...@gmail.com on 19 Jun 2010 at 12:40

GoogleCodeExporter commented 9 years ago
A compile error is now reported

Original comment by stab.hac...@gmail.com on 26 Jun 2010 at 3:06