Skip to content
This repository has been archived by the owner on Feb 22, 2018. It is now read-only.

Finalize override semantics with dynamic-typed parameters #289

Closed
vsmenon opened this issue Aug 14, 2015 · 3 comments
Closed

Finalize override semantics with dynamic-typed parameters #289

vsmenon opened this issue Aug 14, 2015 · 3 comments

Comments

@vsmenon
Copy link
Contributor

vsmenon commented Aug 14, 2015

We need to nail down which of these overrides to allow and disallow:

class A {
  void foo(dynamic x) { ... }
  void bar(int y) { ... }
}

class B extends A {
  void foo(int x) { ... }
  void bar(dynamic y) { ... }
}

class C extends B {
  void bar(String y) { ... }
}
@jmesserly
Copy link
Contributor

Not sure if this is the right bug, but we've discussed covariant parameter types in overrides (and adding a check). I thought it was interesting that Eiffel supported this:
https://en.wikipedia.org/wiki/Covariance_and_contravariance_(computer_science)#Contravariant_method_argument_type

I think we were considering some explicit annotation (on the base class method? Or on the derived class method?) to opt in.

@jmesserly
Copy link
Contributor

merging into analyzer bug: dart-lang/sdk#25232

@jmesserly
Copy link
Contributor

actually moved to: dart-lang/sdk#25578, the other bug turned out to not be strong mode specific

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

3 participants