Repository navigation
binding: look up members of base interfaces and Object for interfaces - #50
Merged
Merged
Conversation
For an interface, Type.GetMembers and Type.GetMethods return only the members the interface declares. A context member of type IList<int> had no Count, Contains, or GetEnumerator, no interface-typed value had ToString or GetHashCode, and an indexer declared in a base interface was not found. As in C#, also look up the members of the base interfaces and Object. A field or property of a derived interface hides the members with the same name of its base interfaces, and a method hides the method with the same signature of a base interface or Object. A member declared in two unrelated base interfaces, such as Count of an interface that extends both IList<int> and IReadOnlyList<int>, is reported as an ambiguous match. Static members of base interfaces and Object are also found through the interface name. Unqualified names still use only the static members declared by the imported types, as with using static in C#.
This was referenced Nov 21, 2026
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
An interface type exposed only the members it declares. With a context member
IList<int> List,List.Count,List.Contains(2), andList.GetEnumerator()failed with "Cannot resolve symbol", andToString()orGetHashCode()could not be called on any interface-typed value. An indexer declared in a base interface was not found either.This PR looks up the members of an interface type in the interface, its base interfaces, and
Object, as C# does:Object, soList.GetEnumerator()returnsIEnumerator<int>;Countof an interface that extends bothIList<int>andIReadOnlyList<int>, is reported as an ambiguous match, like CS0229 in C#.Static members of base interfaces and
Objectare also available through the interface name. Unqualified names still use only the static members declared by the imported types, asusing staticdoes in C#. Lookup in classes does not change.