-
Notifications
You must be signed in to change notification settings - Fork 790
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 #557 - public type implements an internal interface that uses an internal type #1920
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
96fc407
Try to fix #557.
kurtschelfthout 7a6be50
Expand test and move to better place.
kurtschelfthout b840262
Merge remote-tracking branch 'refs/remotes/origin/master' into bug-557
kurtschelfthout 5890e08
Small tweak so test name shows up.
kurtschelfthout File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
84 changes: 84 additions & 0 deletions
84
...e/DeclarationElements/AccessibilityAnnotations/basic/InterfaceImplementationVisibility.fs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
|
||
module Definitions = | ||
|
||
type private PrivateArg() = class end | ||
|
||
type internal InternalArg() = class end | ||
|
||
type PublicArg() = class end | ||
|
||
type private IPrivateInterface = | ||
abstract A : PublicArg -> InternalArg | ||
abstract B : PublicArg -> PrivateArg | ||
abstract C : InternalArg -> PrivateArg | ||
|
||
type internal IInternalInterface = | ||
abstract A : PublicArg -> InternalArg | ||
|
||
type IPublicInterface = | ||
abstract A : PublicArg -> PublicArg | ||
|
||
// class accessibility should have no bearing on | ||
// being able to implement any of these; as long | ||
// as all the types are accessible at the implementation | ||
// location the compiler need not complain. | ||
|
||
// this already worked in F# 4.0 | ||
type private PrivateClass() = | ||
interface IPrivateInterface with | ||
member __.A _ = InternalArg() | ||
member __.B _ = PrivateArg() | ||
member __.C _ = PrivateArg() | ||
interface IInternalInterface with | ||
member __.A _ = InternalArg() | ||
interface IPublicInterface with | ||
member __.A _ = PublicArg() | ||
|
||
// these two did no work in F# 4.0. | ||
type internal InternalClass() = | ||
interface IPrivateInterface with | ||
member __.A _ = InternalArg() | ||
member __.B _ = PrivateArg() | ||
member __.C _ = PrivateArg() | ||
interface IInternalInterface with | ||
member __.A _ = InternalArg() | ||
interface IPublicInterface with | ||
member __.A _ = PublicArg() | ||
|
||
type public PublicClass() = | ||
interface IPrivateInterface with | ||
member __.A _ = InternalArg() | ||
member __.B _ = PrivateArg() | ||
member __.C _ = PrivateArg() | ||
interface IInternalInterface with | ||
member __.A _ = InternalArg() | ||
interface IPublicInterface with | ||
member __.A _ = PublicArg() | ||
|
||
let private privateValue = PrivateClass() | ||
let private privateValueAsPrivateInterface = privateValue :> IPrivateInterface | ||
let internal privateValueAsInternalInterface = privateValue :> IInternalInterface | ||
let privateValueAsPublicInterface = privateValue :> IPublicInterface | ||
|
||
let internal internalValue = InternalClass() | ||
let private internalValueAsPrivateInterface = internalValue :> IPrivateInterface | ||
let internal internalValueAsInternalInterface = internalValue :> IInternalInterface | ||
let internalValueAsPublicInterface = internalValue :> IPublicInterface | ||
|
||
let publicValue = PublicClass() | ||
let private publicValueAsPrivateInterface = publicValue :> IPrivateInterface | ||
let internal publicValueAsInternalInterface = publicValue :> IInternalInterface | ||
let publicValueAsPublicInterface = publicValue :> IPublicInterface | ||
|
||
module OtherModule = | ||
open Definitions | ||
|
||
// internal and public is all you can see here; private interface are not visible. | ||
|
||
let internal internalValue = InternalClass() | ||
let internal internalValueAsInternalInterface = internalValue :> IInternalInterface | ||
let internalValueAsPublicInterface = internalValue :> IPublicInterface | ||
|
||
let publicValue = PublicClass() | ||
let internal publicValueAsInternalInterface = publicValue :> IInternalInterface | ||
let publicValueAsPublicInterface = publicValue :> IPublicInterface |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
.../Source/Conformance/DeclarationElements/InterfaceSpecificationsAndImplementations/env.lst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
SOURCE=GenericMethodsOnInterface01.fs # GenericMethodsOnInterface01.fs | ||
SOURCE=GenericMethodsOnInterface02.fs # GenericMethodsOnInterface02.fs | ||
SOURCE=ConcreteUnitOnInterface01.fs # ConcreteUnitOnInterface01.fs | ||
SOURCE=ConcreteUnitOnInterface01.fs # ConcreteUnitOnInterface01.fs |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this be module internal?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That could be an additional test, but for the purpose of this fix I was trying to make things as clear as possible by keeping everything public except the interfaces/types themselves.