Repository navigation
fix(nitrogen): avoid impossible type check for RecyclableView on Kotlin 2.4 - #2011
Open
guettonenrique wants to merge 1 commit into
Open
guettonenrique wants to merge 1 commit into
guettonenrique wants to merge 1 commit into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
This branch was previously deployed
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.
Summary
Fixes a fatal Android compilation error when building Nitro Hybrid Views with Kotlin 2.4+.
Problem
Under Kotlin 2.4.0 (KTLC-365: "Prohibit always-false is checks for definitely incompatible types"), statically impossible
ischecks betweenfinalclasses and unrelated interfaces were upgraded from compiler warnings to fatal compilation errors.When a Kotlin
HybridViewimplementation class does not implementRecyclableView, Nitrogen's generatedViewManagercontains:Because
hybridViewis afinalclass that doesn't implementRecyclableView, this fails compilation on Kotlin 2.4+ with:Because this is now a fatal compilation error in Kotlin 2.4,
@Suppress("USELESS_IS_CHECK")can no longer suppress it.Solution
hybridViewthroughAnyfirst (val recyclableView = (hybridView as Any) as? RecyclableView). This satisfies Kotlin 2.4's static type checker while remaining fully compatible with earlier Kotlin versions and preserving exact runtime semantics.bun specsto regenerate and update the committed test fixture bindings intests/react-native/.Test plan
1. Monorepo Build & Typecheck
bun run buildandbun typecheck0across all workspaces.2. Nitrogen Output Verification
bun specstests/react-native/test fixtures with no unexpected diffs.3. Real-World Android Build
BUILD SUCCESSFUL), eliminating the fatalCheck for instance is always 'false'error.Checklist
bun run buildandbun typecheckbun specsand committed all generated fixture updates