ceylon / ceylon-spec

DEPRECATED
Apache License 2.0
108 stars 34 forks source link

native implementation mistaken for header #1443

Closed jvasileff closed 8 years ago

jvasileff commented 8 years ago

This type checks:

class NC2() {
    native("jvm") shared void foo() => print("impl 1");
    native("jvm") shared void foo() => print("impl 2");
}

but, should have:

  1. "Native member does not implement any header member: foo in NC2"
  2. "Duplicate native implementation: foo"
quintesse commented 8 years ago

Can't reproduce this, I get:

./source/test/test.ceylon:8: error: foo() is already defined in NC2
    native("jvm") shared void foo() => print("impl 2");
jvasileff commented 8 years ago

Oh, right, this is actually much more nuanced.

  1. In Eclipse, with just "compile to project to JS", no error is produced for the original example.
  2. Same as above, but with one of the declarations removed, an error is produced.
  3. At the CLI, ceylon compile-js produces no error regardless of how many native("jvm") declarations exist.
  4. If instead, we use native("js"), ceylon compile produces an error for one declaration, not with two or more.
quintesse commented 8 years ago
  1. and 3. are basically the same thing and is something specific for the JS backend: it just ignores all errors in code marked for the JVM. The other two are also a single issue really, which is that no dups are detected if there's no header.
quintesse commented 8 years ago

The duplicates should now generate proper errors.

quintesse commented 8 years ago

Will close this issue because what's described has been fixed.