Skip to content

Commit 13c2172

Browse files
authored
[views] Fix a couple of typos, renames, and an example. (#2545)
1 parent 3324032 commit 13c2172

File tree

1 file changed

+21
-8
lines changed

1 file changed

+21
-8
lines changed

working/1426-extension-types/feature-specification-views.md

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -786,7 +786,7 @@ A compile-time error occurs if a view _DV_ has two superviews `V1` and
786786
`V2`, where both `V1` and `V2` has a member named _m_ with distinct
787787
declarations, and _DV_ does not declare a member named _m_.
788788

789-
*In other words, if two different declarations of _m_ is inherited
789+
*In other words, if two different declarations of _m_ are inherited
790790
from two superviews then the subview must resolve the conflict. The
791791
so-called diamond inheritance pattern can create the case where two
792792
superviews have an _m_, but they are both declared by the same
@@ -831,25 +831,38 @@ and `V2` are superviews of _DV_. Let `M1` be the members of `V1`, and
831831
member name `m` such that `V1` as well as `V2` has a member named `m`,
832832
and they are distinct declarations, and _DV_ does not declare a member
833833
named `m`. *In other words, a name clash among distinct "inherited"
834-
members is an error, but it can be eliminated by overriding the
834+
members is an error, but it can be eliminated by redeclaring the
835835
clashing name.*
836836

837837
The effect of having a view declaration _DV_ with superviews
838838
`V1, .. Vk` is that the members declared by _DV_ as well as all
839-
members of `V1, .. Vk` that are not overridden by a declaration in
839+
members of `V1, .. Vk` that are not redeclared by a declaration in
840840
_DV_ can be invoked on a receiver of the type introduced by _DV_.
841841

842842
In the body of _DV_, a superinvocation syntax similar to an explicit
843843
extension method invocation can be used to invoke a member of a
844-
superview which is overridden: The invocation starts with `super.`
844+
superview which is redeclared: The invocation starts with `super.`
845845
followed by the name of the given superview, followed by the member
846846
access. The superview may be omitted in the case where there is no
847847
ambiguity.
848848

849-
*For instance, `super.V3.foo()` can be used to call the `foo` of `V3`
850-
in the case where the extends clause has `extends ... V3 hide foo, ...`.
851-
If no other superview has a member with basename `foo`, it is
852-
also possible to call it using `super.foo()`.*
849+
*For example:*
850+
851+
```dart
852+
view class V2 {
853+
void foo() { print('V2.foo()'); }
854+
}
855+
856+
view class V3 {
857+
void foo() { print('V2.foo()'); }
858+
}
859+
860+
view class V1 implements V2, V3 {
861+
void bar() {
862+
super.V3.foo(); // Prints "V2.foo()".
863+
}
864+
}
865+
```
853866

854867

855868
## Dynamic Semantics of Views

0 commit comments

Comments
 (0)