Repository navigation
fix(generic): fail wrongly sized [GenerateGenericTest] in source-generated mode #7344
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
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
aead47f
fix(generic): fail wrongly sized [GenerateGenericTest] in source-gene…
thomhurst 847889b
fix(generic): close review gaps in [GenerateGenericTest] arity failur…
thomhurst 24d306b
fix(generic): keep class data for failing instance-source rows; share…
thomhurst a096091
fix(generic): keep class rows on violations without [GenerateGenericT…
thomhurst 61dd68e
fix(generic): reject null [GenerateGenericTest] type arguments and de…
thomhurst 60d288e
fix(generic): join deferred broad sources on class-row [GenerateGener…
thomhurst 065db62
fix(generic): join deferred method sources only on their own concrete…
thomhurst 80b5eed
fix(generic): match [Arguments] by full name in method source check; …
thomhurst 80fe1b0
fix(generic): fail a class-level pointer [GenerateGenericTest] instea…
thomhurst 7c33714
fix: preserve explicit attributes on generic arity failures (#7222)
thomhurst e7fecb0
test: preserve skipped generic violation expectations (#7222)
thomhurst 7b03504
fix: preserve class attributes on discovery failures (#7222)
thomhurst 74e99e0
test: refresh skipped generic constraint snapshot (#7222)
thomhurst File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
356 changes: 303 additions & 53 deletions
356
src/TUnit.Core.SourceGenerator/Generators/TestMetadataGenerator.cs
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
26 changes: 26 additions & 0 deletions
26
src/TUnit.Core/Helpers/GenerateGenericTestArityMessages.cs
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| using System.Collections.Generic; | ||
| using System.Globalization; | ||
|
|
||
| namespace TUnit.Core.Helpers; | ||
|
|
||
| /// <summary> | ||
| /// The failure messages for a method-level <c>[GenerateGenericTest]</c> whose type arguments cannot close the | ||
| /// method. Reflection mode (TUnit.Engine) uses this class, and TUnit.Core.SourceGenerator compiles this same file, | ||
| /// so both modes report the same text (#7222). Callers pass type names already formatted as <c>Type.Name</c> gives them. | ||
| /// </summary> | ||
| internal static class GenerateGenericTestArityMessages | ||
| { | ||
| /// <summary>How a null type argument, such as <c>[GenerateGenericTest((Type)null!)]</c>, is named.</summary> | ||
| public const string NullTypeName = "null"; | ||
|
|
||
| public static string NoTypeArguments(string methodName) | ||
| => $"[GenerateGenericTest] on method '{methodName}' has no type arguments"; | ||
|
|
||
| public static string WrongCount(string methodName, int providedCount, int requiredCount, IEnumerable<string> providedTypeNames) | ||
| => $"[GenerateGenericTest] on method '{methodName}' provides {providedCount.ToString(CultureInfo.InvariantCulture)} type argument(s) " | ||
| + $"but method requires {requiredCount.ToString(CultureInfo.InvariantCulture)}. " | ||
| + $"Provided: [{string.Join(", ", providedTypeNames)}]"; | ||
|
|
||
| public static string InvalidTypeArgument(string methodName, string typeName) | ||
| => $"[GenerateGenericTest] on method '{methodName}' provides type argument '{typeName}', which cannot be a generic type argument"; | ||
| } |
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.