Skip to content

Commit

Permalink
Update object-declarations anonymous object return types (#4588)
Browse files Browse the repository at this point in the history
* Update object-declarations.md

* Update docs/topics/object-declarations.md

Co-authored-by: Dániel Csorba <[email protected]>

* Update object-declarations.md

---------

Co-authored-by: Dániel Csorba <[email protected]>
  • Loading branch information
UndefinedBehaviour and daniCsorbaJB authored Dec 5, 2024
1 parent 830c477 commit 7af1fed
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions docs/topics/object-declarations.md
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ fun main() {

### Use anonymous objects as return and value types

When you return an anonymous object from a local or [`private`](visibility-modifiers.md#packages) function or property (but not an [inline function](inline-functions.md)),
When you return an anonymous object from a local or [`private`](visibility-modifiers.md#packages) function or property,
all the members of that anonymous object are accessible through that function or property:

```kotlin
Expand Down Expand Up @@ -469,7 +469,7 @@ fun main() {
This allows you to return an anonymous object with specific properties,
offering a simple way to encapsulate data or behavior without creating a separate class.

If a function or property that returns an anonymous object is `public` or `private`, its actual type is:
If a function or property that returns an anonymous object has `public`, `protected`, or `internal` visibility, its actual type is:

* `Any` if the anonymous object doesn't have a declared supertype.
* The declared supertype of the anonymous object, if there is exactly one such type.
Expand Down

0 comments on commit 7af1fed

Please sign in to comment.