Skip to content
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 Cache<_, Value, _> type parameter variance (covariant -> invariant) #3404

Merged
merged 5 commits into from
Aug 12, 2024

Conversation

KhraksMamtsov
Copy link
Contributor

@KhraksMamtsov KhraksMamtsov commented Aug 3, 2024

Type

  • Refactor
  • Feature
  • Bug Fix
  • Optimization
  • Documentation Update

Description

Related

  • Related Issue #
  • Closes #

Copy link

changeset-bot bot commented Aug 3, 2024

🦋 Changeset detected

Latest commit: 1a5ab6c

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 31 packages
Name Type
effect Patch
@effect/cli Patch
@effect/cluster-browser Patch
@effect/cluster-node Patch
@effect/cluster-workflow Patch
@effect/cluster Patch
@effect/experimental Patch
@effect/opentelemetry Patch
@effect/platform-browser Patch
@effect/platform-bun Patch
@effect/platform-node-shared Patch
@effect/platform-node Patch
@effect/platform Patch
@effect/printer-ansi Patch
@effect/printer Patch
@effect/rpc-http Patch
@effect/rpc Patch
@effect/schema Patch
@effect/sql-d1 Patch
@effect/sql-drizzle Patch
@effect/sql-kysely Patch
@effect/sql-mssql Patch
@effect/sql-mysql2 Patch
@effect/sql-pg Patch
@effect/sql-sqlite-bun Patch
@effect/sql-sqlite-node Patch
@effect/sql-sqlite-react-native Patch
@effect/sql-sqlite-wasm Patch
@effect/sql Patch
@effect/typeclass Patch
@effect/vitest Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you"re a maintainer who wants to add another changeset to this PR

@mikearnaldi
Copy link
Member

just changing out to in out doesn"t actually affect variance when compared structurally, we should use the Variance trick we use in Effect and on the other types to force a specific variance

@KhraksMamtsov
Copy link
Contributor Author

Done.
I used the Cache.Variance type for the regular Cache, and for ConsumerCache - Cache.ConsumerVariance.
And now CacheImpl contains both Variance symbols.
I was looking at Queue which implements Enqueue + Dequeue

packages/effect/src/Cache.ts Outdated Show resolved Hide resolved
packages/effect/src/Cache.ts Outdated Show resolved Hide resolved
packages/effect/src/Cache.ts Outdated Show resolved Hide resolved
packages/effect/src/Cache.ts Outdated Show resolved Hide resolved
@tim-smart tim-smart merged commit 8295281 into Effect-TS:main Aug 12, 2024
11 checks passed
@github-actions github-actions bot mentioned this pull request Aug 12, 2024
@KhraksMamtsov KhraksMamtsov deleted the cache-fix-variance branch September 25, 2024 09:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants