Vim9 interface changes to follow the new interface specification:
https://github.com/vim/vim/pull/13100
(3 files)
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
@yegappan pushed 1 commit.
—
View it on GitHub or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
Merging #13100 (a8b7628) into master (ffb1367) will decrease coverage by
1.60%.
The diff coverage is96.42%.
@@ Coverage Diff @@ ## master #13100 +/- ## ========================================== - Coverage 78.26% 76.66% -1.60% ========================================== Files 150 150 Lines 152693 152425 -268 Branches 39364 39287 -77 ========================================== - Hits 119508 116861 -2647 - Misses 20935 23532 +2597 + Partials 12250 12032 -218
| Flag | Coverage Δ | |
|---|---|---|
| mingw-x64-HUGE | 76.66% <96.42%> (-0.02%) |
⬇️ |
| mingw-x86-HUGE | ? |
|
| windows | 76.66% <96.42%> (-1.60%) |
⬇️ |
Flags with carried forward coverage won't be shown. Click here to find out more.
| Files Changed | Coverage Δ | |
|---|---|---|
| src/vim9class.c | 87.81% <96.42%> (-0.38%) |
⬇️ |
... and 86 files with indirect coverage changes
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
@errael commented on this pull request.
In src/errors.h:
> INIT(= N_("E1377: Static member is not supported in an interface"));
EXTERN char e_method_str_of_class_str_has_different_access[]
INIT(= N_("E1378: Access level of method \"%s\" is different in class \"%s\""));
+EXTERN char e_static_cannot_be_used_in_interface[]
+ INIT(= N_("E1379: Static cannot be used in an interface"));
E1377 is not used. Looks E1379 has taken it's place.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
In the following class B satisfies the I2 contract since F1 is inherited from class A. Doesn't seem like should be an error. An equivalent Java program compiles fine.
E1349: Function "F1" of interface "I2" not implemented
vim9script
interface I2
def F1()
def F2()
endinterface
class A
def F1()
enddef
endclass
class B extends A implements I2
def F2()
enddef
endclass
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
This seems like it should work. Gets
E1315: White space required after name: I1, I2
vim9script
interface I1
def F1()
def F2()
endinterface
interface I2
def F2()
def F3()
endinterface
interface I3 extends I1, I2
endinterface
class C implements I3
def F1()
enddef
def F2()
enddef
def F3()
enddef
endclass
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
This seems like it should work. Gets
E1315: White space required after name: I1, I2vim9script interface I1 def F1() def F2() endinterface interface I2 def F2() def F3() endinterface interface I3 extends I1, I2
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
Currently only one interface or class name can be specified after "extends"
"Currently" as in squeeze it in or possible post vim9.1 thing. There are straightforward workarounds, as seen in the example below. But there's an issue as shown in the next message
vim9script
interface I1
def F1()
def F2()
endinterface
interface I2 extends I1
def F2()
def F3()
endinterface
# want "extends I1, I2", so manually add I2's stuff to I3
interface I3 extends I1
def F2()
def F3()
endinterface
# and manually add I2 to class C
class C implements I3, I2
def F1()
enddef
def F2()
enddef
def F3()
enddef
endclass
def F1(i: I1)
enddef
def F2(i: I2)
enddef
def F3(i: I3)
enddef
var oc = C.new()
F1(oc)
F2(oc)
F3(oc)
—
Reply to this email directly, view it on GitHub.
You are receiving this because you commented.![]()
Looks like an inherited interface is not getting picked up by a class
E1013: Argument 1: type mismatch, expected object<I1> but got object<C>
vim9script
interface I1
def F1()
endinterface
interface I2 extends I1
def F2()
endinterface
class C implements I2
def F1()
enddef
def F2()
enddef
endclass
def F1(i: I1)
enddef
var oc = C.new()
F1(oc)
—
Reply to this email directly, view it on GitHub.
You are receiving this because you commented.![]()
Member can not be repeated in subinterface (but function can)
E1369: Duplicate member: rval
vim9script
interface I1
this.rval: string
endinterface
interface I2 extends I1
this.rval: string
endinterface
But this works
vim9script
interface I1
def F1()
endinterface
interface I2 extends I1
def F1()
endinterface
—
Reply to this email directly, view it on GitHub.
You are receiving this because you commented.![]()
(Similar to #13100 (comment) but with members.)
In the following class B satisfies the I2 contract since rval1 is inherited from class A.
E1348: Member "rval1" of interface "I2" not implemented
vim9script
interface I2
this.rval1: number
this.rval2: number
endinterface
class A
this.rval1: number
endclass
class B extends A implements I2
this.rval2: number
endclass
—
Reply to this email directly, view it on GitHub.
You are receiving this because you commented.![]()
@yegappan commented on this pull request.
In src/errors.h:
> INIT(= N_("E1377: Static member is not supported in an interface"));
EXTERN char e_method_str_of_class_str_has_different_access[]
INIT(= N_("E1378: Access level of method \"%s\" is different in class \"%s\""));
+EXTERN char e_static_cannot_be_used_in_interface[]
+ INIT(= N_("E1379: Static cannot be used in an interface"));
I have used E1377 for some other message.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you commented.![]()
Member can not be repeated in subinterface (but function can)
I have updated the PR to address this.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you commented.![]()
(Similar to #13100 (comment) but with members.)
In the following
class Bsatisfies theI2contract sincerval1is inherited fromclass A.E1348: Member "rval1" of interface "I2" not implemented
I have updated the PR to address this.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you commented.![]()
Looks like an inherited interface is not getting picked up by a class
E1013: Argument 1: type mismatch, expected object<I1> but got object<C>
This should be addressed in the updated PR.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you commented.![]()
Missing interface variable type checking.
This executes with no error. Expect compilation errors. And I hope you get at least a chuckle over the behavior described in the comment to class C ...
vim9script
interface I1
public this.rval: number
endinterface
# this should produce a type mismatch error
interface I2 extends I1
public this.rval: string
endinterface
# I've never been entirely clear on when/if a variable gets a type,
# but in the following, if rval is not given a type, it is "any".
#
# If it is typed number it complains about wanting string, and vice versa.
#
class C implements I2
#public this.rval: list<string> = [ "init-rval" ]
#public this.rval: string
#public this.rval: number
public this.rval = [ "init-rval" ]
endclass
var oc = C.new()
echo "oc.rval:" oc.rval
oc.rval = "xxx"
echo "oc.rval:" oc.rval
—
Reply to this email directly, view it on GitHub.
You are receiving this because you commented.![]()
Missing interface variable type checking.
I have updated the PR with a fix for this.
This executes with no error. Expect compilation errors. And I hope you get at least a chuckle over the behavior described in the comment to
class C ...
Yes. I have added a fix for this issue also in the PR.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you commented.![]()
Looks good and ready for wider use. Maybe I'll think of something extremely obscure tomorrow, but maybe not.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you commented.![]()
—
Reply to this email directly, view it on GitHub.
You are receiving this because you commented.![]()