Skip to content

Address NRT review feedback and clear remaining warnings - #164

Merged
imnasnainaec merged 2 commits into
enable-nrt-corefrom
resolve-nrt-reviews
Sep 9, 2026
Merged

Address NRT review feedback and clear remaining warnings#164
imnasnainaec merged 2 commits into
enable-nrt-corefrom
resolve-nrt-reviews

Conversation

@imnasnainaec

@imnasnainaec imnasnainaec commented Aug 31, 2026

Copy link
Copy Markdown
Collaborator

In place of the long-winded AI-drafted reviews I posted on #157, I offer this pr pr.


This change is Reviewable

- MapToExistingLanguageIfPossible now returns the empty string (not null)
  for empty input, honoring its [return: NotNullIfNotNull] contract.
- Removed the incorrect [MemberNotNullWhen(false, Id, Source, Target)] from
  XLiffTransUnit.IsEmpty: IsEmpty is a conjunction, so !IsEmpty does not
  imply all three members are non-null. Adjusted ToString and
  XLiffBody.AddTransUnitRaw, which relied on that bogus guarantee.
- DefaultInstalledStringFilePath now throws a clear InvalidOperationException
  instead of passing a possibly-null folder to Path.Combine.
- StringCache is backed by a nullable field and throws a clear
  InvalidOperationException instead of being `null!` and NREing when the
  minimal constructor was used.
- MergeXliffDocuments hoists the trans-unit id once per iteration and skips
  units without one, replacing ten null-forgiving `tu.Id!` uses.
- Fixed the four remaining warnings: CS8604 in XLiffBody (hoisted documented
  locals) and CS8618 for DefaultStringFilePath (defaults to string.Empty).

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@imnasnainaec
imnasnainaec marked this pull request as ready for review August 31, 2026 19:31
@imnasnainaec
imnasnainaec requested a review from hahn-kev August 31, 2026 19:31

@hahn-kev hahn-kev left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I'd like to fix the 2 tu.Id! overrides we have as that only holds true if the methods which set the Id never change. I'd opt to throw so we catch the issue early, but if that is highly likely to bubble up to the user then I'd probably avoid that. But we could always just add a test for each that would catch the error in CI.

Comment thread src/L10NSharp/XLiffUtils/XLiffBody.cs Outdated
@imnasnainaec
imnasnainaec merged commit 37ea126 into enable-nrt-core Sep 9, 2026
1 of 2 checks passed
@imnasnainaec
imnasnainaec deleted the resolve-nrt-reviews branch September 9, 2026 12:06
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