Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: finish support of type assertions which was incomplete #657

Merged
merged 6 commits into from
Jun 10, 2020
Merged

Conversation

mvertes
Copy link
Member

@mvertes mvertes commented May 27, 2020

TypeAssert was optimistically returning ok without verifying that
value could be converted to the required interface (in case of
type assert of an interface type), or not checking the type in
all conditions. There is now a working implements method for
itype.

The implementation also relies on internal type checks
performed by the go runtime when assertions operate
on non-emulated types, whenever possible.

A couple of calls to panic() have been added to match
the specification (assert with no status). It still can be difficult to
distinguish between a panic due to wrong user code,
or a bug in yaegi. This will be improved later.

Fixes #640.

TypeAssert was optimistically returning ok without verifying that
value could be converted to the required interface (in case of
type assert of an interface type), or not checking the type in
all conditions. There is now a working implements method for itype.

Fixes #640.
@mvertes mvertes added bug Something isn't working area/core labels May 27, 2020
@mvertes mvertes added this to the v0.8.x milestone May 27, 2020
@mvertes mvertes requested a review from mpl May 28, 2020 08:32
interp/type.go Show resolved Hide resolved
interp/run.go Show resolved Hide resolved
interp/run.go Show resolved Hide resolved
interp/type.go Show resolved Hide resolved
interp/type.go Show resolved Hide resolved
@mvertes mvertes merged commit c1f5005 into master Jun 10, 2020
@mvertes mvertes deleted the fix-640 branch June 10, 2020 09:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/core bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

value of type struct is not assignable to type struct
2 participants