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

private method can become public by type annotations but without any warning #7107

Closed
vicuna opened this issue Dec 24, 2015 · 1 comment
Closed
Assignees

Comments

@vicuna
Copy link

vicuna commented Dec 24, 2015

Original bug ID: 7107
Reporter: furuse
Assigned to: @garrigue
Status: closed (set by @xavierleroy on 2017-09-24T15:31:48Z)
Resolution: not a bug
Priority: normal
Severity: major
Version: 4.02.3
Category: typing
Related to: #3231

Bug description

class type ct = object method x : int end

class c : ct = object method private x = 1 end

class c' = object method virtual m : int method private m = 1 end

The classes c and c' have public methods, though their implementations are declared private. Issue 3231 #3231 , it is explaned an intended behaviour, but they are surprising.

I thought Warning 15: the following private methods were made public implicitly: ... should be for this but no warning is reported. What is Warning 15 for?

@vicuna
Copy link
Author

vicuna commented Feb 4, 2016

Comment author: @garrigue

Warning 15 is for private methods turned public through an external method call:

class c = object (self : 'self)

method private x = 1
method add (other : 'self) = self#x + other#x

end;;
Warning 15: the following private methods were made public implicitly:
x.

Here the method call self#x is private, but other#x forces x to become public.

Making a method public through an explicit coercion is explicit, not implicit.

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

No branches or pull requests

2 participants