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

Better message for invalid uses of "virtual" #6182

Closed
vicuna opened this issue Sep 16, 2013 · 1 comment
Closed

Better message for invalid uses of "virtual" #6182

vicuna opened this issue Sep 16, 2013 · 1 comment

Comments

@vicuna
Copy link

@vicuna vicuna commented Sep 16, 2013

Original bug ID: 6182
Reporter: @lpw25
Assigned to: @alainfrisch
Status: closed (set by @xavierleroy on 2015-12-11T18:24:09Z)
Resolution: fixed
Priority: normal
Severity: feature
Version: 4.01.0
Fixed in version: 4.02.0+dev
Category: typing

Bug description

The attached patch (based on one by Stephen Dolan) gives a more accurate error message if you include virtual methods in an immediate object or class type.

Before:

class x = object method virtual m : int end;;

Characters 6-43:
class x = object method virtual m : int end;;
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error: This class should be virtual. The following methods are undefined : m

class type x = object method virtual m : int end;;

Characters 11-48:
class type x = object method virtual m : int end;;
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error: This class should be virtual. The following methods are undefined : m

let x = object method virtual m : int end;;

Characters 8-41:
let x = object method virtual m : int end;;
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error: This class should be virtual. The following methods are undefined : m

After:

class x = object method virtual m : int end;;

Characters 6-43:
class x = object method virtual m : int end;;
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error: This class should be virtual. The following methods are undefined : m

class type x = object method virtual m : int end;;

Characters 11-48:
class type x = object method virtual m : int end;;
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error: This class type should be virtual.
The following methods are undefined : m

let x = object method virtual m : int end;;

Characters 8-41:
let x = object method virtual m : int end;;
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error: This object has virtual methods.
The following methods are undefined : m

File attachments

@vicuna
Copy link
Author

@vicuna vicuna commented Sep 17, 2013

Comment author: @alainfrisch

Thanks!

Applied to trunk, commit 14155.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants