Repository navigation
Return a DirectoryName from every directory type's Name [major] - #500
Merged
Merged
Conversation
AbsoluteDirectoryPath.Name and DirectoryPath.Name returned a FileName while RelativeDirectoryPath.Name returned a DirectoryName. The '/' operator picks its result type from the right operand, so dir.Parent / dir.Name rebuilt an absolute directory as an AbsoluteFilePath, walking a directory into the file side of the type system. Both now return a DirectoryName. RelativeDirectoryPath also gains the '/ DirectoryName' operator the other two directory types already had: without it, dir.Parent / dir.Name did not compile for a relative directory at all. Now the expression has the same type as dir for every directory type. The name is still the last component as written, so the name of /home/user/.. is "..". This changes the public return type of two properties, so the release is [major] and docs/migration-guide-6.0.md describes the migration. Package validation here compares target frameworks rather than a baseline release, and every target changes alike, so no compatibility suppression is needed. Fixes #498 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017vfJW6XNeWiDxG4BVzYTra
|
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.



Fixes #498
Problem
AbsoluteDirectoryPath.NameandDirectoryPath.Namereturned aFileName, butRelativeDirectoryPath.Namereturned aDirectoryName. The/operator picks its result type from the right operand. Sodir.Parent / dir.Namerebuilt an absolute directory as anAbsoluteFilePath.Change
AbsoluteDirectoryPath.NameandDirectoryPath.Namenow returnDirectoryName.FileNameandDirectoryNamevalidate identically, so every name that was accepted before still is.RelativeDirectoryPathgainsoperator /(RelativeDirectoryPath, DirectoryName). This corrects the issue: it says the expression already stayed a directory forRelativeDirectoryPath. In fact the operator was missing anddir.Parent / dir.Namefailed withCS0019. The other two directory types already had this operator, so it is needed to meet the "every directory type" criterion./home/user/..is still...docs/migration-guide-6.0.mdand listed it inCLAUDE.md.On the
CompatibilitySuppressions.xmlentry the issue asked forIt isn't needed, and adding one would break the build. Package validation in this repo compares target frameworks against each other, not against a released baseline. This change applies to every target alike, and
dotnet pack Semantics.Paths -c Releasesucceeds with no CP diagnostics. An unused suppression is itself an error; that is what stopped Containers#123 from releasing.Overlap with #496
#496 also creates
docs/migration-guide-6.0.md, with a section onPH.ToPOH. Both PRs use the same title line. Whichever merges second gets an add/add conflict, which is resolved by keeping both sections.Tests
Semantics.Test/Paths/DirectoryNameRebuildTests.cs:AbsoluteDirectoryPath,DirectoryPathandRelativeDirectoryPath,dir.Parent / dir.Nameis assigned to the same type asdirand is equal todir...name is pinned as written.Without the fix this file does not compile:
CS0029for the absolute and generic types, andCS0019for the relative type. With the fix:Semantics.Testsuite passes (1962 total: 1948 passed, 14 skipped, 0 failed);dotnet packofSemantics.Pathspasses package validation.Generated by Claude Code