Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

"Private" impl functions can leak out of a module when defined on a public type #33479

Closed

Description

@deadalusai

"Private" impl functions can leak out of a module when defined on a public type. This can allow private types to appear as part of a modules' public interface.

Example on playground: http://is.gd/aGx2MV

In this example, the type Private leaks out of the_module via the impl Public<Private> impl block. It looks like all functions in that block should be inferred to be private?

Reddit discussion

Activity

  1. deadalusai commented on May 7, 2016

    @deadalusai
    Author

    This issue seems similar.

  2. petrochenkov commented on May 7, 2016

    @petrochenkov
    Contributor

    Yep, incarnation of #30476 (although the example is sufficiently different from those given in #30476), one more example of type inference being too smart.

    Private-in-public checker assumes that the type Public<Private> is private and therefore its impls are private, because you can't name it or construct its values outside of its module without using Private.
    However, type inference is able to infer private type parameters in some cases and it's not something generally fixable with private-in-public checker alone.

  3. self-assigned this
    on Feb 19, 2017
  4. added a commit that references this issue on Jun 5, 2017
  5. added a commit that references this issue on Jul 7, 2017
  6. added
    A-type-system
    and removed
    A-type-system
    on Dec 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

A-type-system

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions