Skip to content

Add top-level type any as semantic version of untyped#5056

Merged
Strech merged 1 commit intomasterfrom
no-ticket-add-top-level-any-rbs-type
Nov 19, 2025
Merged

Add top-level type any as semantic version of untyped#5056
Strech merged 1 commit intomasterfrom
no-ticket-add-top-level-any-rbs-type

Conversation

@Strech
Copy link
Member

@Strech Strech commented Nov 18, 2025

What does this PR do?

Add a Datadog top-level semantic type any.

Motivation:

The type any is going to represent a scenario when the narrowing is impossible to do or when it doesn't make sense to do. And type untyped should represent an actual untyped type (no time, not done, etc)

Change log entry

No.

Additional Notes:

We can get more value out of untyped checks once we start moving to any in case when it's really any type.

How to test the change?

CI

@Strech Strech requested a review from a team as a code owner November 18, 2025 09:38
This type is a semantic version of `untyped` when the accepted or
returned value is literally anything. And `untyped` should be used as a
signal that the typing is not finished yet.
@Strech Strech force-pushed the no-ticket-add-top-level-any-rbs-type branch from 3613564 to f4b627b Compare November 18, 2025 09:43
@lloeki
Copy link
Member

lloeki commented Nov 18, 2025

Very cool.

AIUI both are logically equivalent type-wise, they are semantically not:

  • untyped: "I did not have time to define the proper type for this, so I accept everything and the name serves as a marker to revisit later."
  • any: "I did have time to thoroughly think about what this type should be and it is definitely intended to accept every possible type, so I am communicating that this is intendend as the proper type here."

It's a bit like:

void, boolish, or top?

They are all equivalent for the type system; they are all top type.

void tells developers a hint that the value should not be used. boolish implies the value is used as a truth value. top is anything else.

For context any was a thing but was renamed untyped:

sig/datadog/open_feature/exposures/worker.rbs:48:23: [error] Cannot find type `any`
│ Diagnostic ID: RBS::UnknownTypeName
│
└         def perform: (*any) -> void

Maybe we can make a case upstream to have both?

Copy link
Member

@lloeki lloeki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@pr-commenter
Copy link

pr-commenter bot commented Nov 18, 2025

Benchmarks

Benchmark execution time: 2025-11-18 10:13:15

Comparing candidate commit f4b627b in PR branch no-ticket-add-top-level-any-rbs-type with baseline commit f33bab7 in branch master.

Found 0 performance improvements and 0 performance regressions! Performance is the same for 44 metrics, 2 unstable metrics.

Copy link
Member

@y9v y9v left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I definitely find the proposed change useful

@Strech Strech merged commit 76e965c into master Nov 19, 2025
275 checks passed
@Strech Strech deleted the no-ticket-add-top-level-any-rbs-type branch November 19, 2025 10:26
@github-actions github-actions bot added this to the 2.23.0 milestone Nov 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants