-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #721 from SteveDunn/cast-operator-bug
Feature: more detailed compilation errors when both explicit and implicit casting operators are specific
- Loading branch information
Showing
15 changed files
with
1,001 additions
and
25 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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 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 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 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 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
37 changes: 37 additions & 0 deletions
37
tests/SnapshotTests/BugFixes/Bug720_Inconsistent_casting_mixed_with_IVogen_generation.cs
This file contains 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,37 @@ | ||
using System.Threading.Tasks; | ||
using Shared; | ||
using Vogen; | ||
|
||
namespace SnapshotTests.BugFixes; | ||
|
||
// See https://github.com/SteveDunn/Vogen/issues/720 | ||
public class Bug720_Inconsistent_casting_mixed_with_IVogen_generation | ||
{ | ||
[Fact] | ||
public async Task Works_when_the_static_abstracts_and_implementation_have_same_casting() | ||
{ | ||
// we say that to primitive is implicit and we say that the static abstract interface matches. | ||
var source = """ | ||
using Vogen; | ||
using static Vogen.StaticAbstractsGeneration; | ||
[assembly: VogenDefaults( | ||
toPrimitiveCasting: CastOperator.Implicit, | ||
staticAbstractsGeneration: ValueObjectsDeriveFromTheInterface | | ||
EqualsOperators | | ||
ExplicitCastFromPrimitive | | ||
ImplicitCastToPrimitive | | ||
FactoryMethods)] | ||
namespace MyApp; | ||
[ValueObject<int>] | ||
public readonly partial record struct ToDoItemId; | ||
"""; | ||
|
||
await new SnapshotRunner<ValueObjectGenerator>() | ||
.WithSource(source) | ||
.IgnoreInitialCompilationErrors() | ||
.RunOn(TargetFramework.AspNetCore8_0); | ||
} | ||
} |
Oops, something went wrong.