Skip to content

Conversation

stwlam
Copy link
Contributor

@stwlam stwlam commented Sep 29, 2025

The getter returns TDatabase["db"]--if TDatabase is an AbstractSublevel--or else TDatabase itself.

@vweevers
Copy link
Member

What's the use case?

@stwlam
Copy link
Contributor Author

stwlam commented Sep 29, 2025

What's the use case?

Suppose one has a sublevel that is an AbstractSublevel<ClassicLevel, any, any, any> of some kind. It is statically knowable that sublevel.db is an AbstractLevel (since it's a ClassicLevel) and not an AbstractSublevel, so getting the full ClassicLevel interface as a return is type-safe and useful.

@stwlam stwlam marked this pull request as draft September 29, 2025 16:57
@stwlam stwlam marked this pull request as ready for review September 29, 2025 17:06
@stwlam
Copy link
Contributor Author

stwlam commented Sep 29, 2025

Sorry, expanded it a bit after a little more testing

The getter returns `TDatabase` if it is an `AbstractLevel`, `TDatabase["db"]` if an `AbstractSublevel`, else some indeterminable kind of `AbstractLevel`.
@vweevers vweevers changed the title Make AbstractSublevel#db have a conditional return type Make AbstractSublevel#db type more specific Sep 29, 2025
@vweevers vweevers merged commit cc290ed into Level:main Sep 29, 2025
6 checks passed
@vweevers
Copy link
Member

3.1.1. Thanks for the contribution!

@stwlam stwlam deleted the patch-1 branch September 29, 2025 20:10
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.

2 participants