-
Notifications
You must be signed in to change notification settings - Fork 199
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Name clash on source generation (#65)
* Initial prototype using dfs and checking for cycles * Polish debugging and fix tests * Update tests and change accessibility for variables for sourcegenerator helper * Add unit tests for diagnostics for users * Move info logs to only successful generation * Get rid of cycle check for next pr * Get rid of stack logic for cycle checks * Cache property values for typewrapper methods * Added more collections relying on T * Fix tests along with adding dicitonary support * Changes on ds and tests to handle name clashes * Update nits and got rid of stacks and queues * Make tests static and delete todos * Delete todos for dictionary types json context * Move test classes to its own file
- Loading branch information
Showing
9 changed files
with
324 additions
and
124 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
92 changes: 92 additions & 0 deletions
92
src/libraries/System.Text.Json/System.Text.Json.SourceGeneration.Tests/TestClasses.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,92 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using System.Text.Json.Serialization; | ||
|
||
namespace System.Text.Json.SourceGeneration.Tests.RepeatedTypes | ||
{ | ||
[JsonSerializable] | ||
public class Location | ||
{ | ||
public int FakeId { get; set; } | ||
public string FakeAddress1 { get; set; } | ||
public string FakeAddress2 { get; set; } | ||
public string FakeCity { get; set; } | ||
public string FakeState { get; set; } | ||
public string FakePostalCode { get; set; } | ||
public string FakeName { get; set; } | ||
public string FakePhoneNumber { get; set; } | ||
public string FakeCountry { get; set; } | ||
} | ||
} | ||
|
||
namespace System.Text.Json.SourceGeneration.Tests | ||
{ | ||
[JsonSerializable] | ||
public class Location | ||
{ | ||
public int Id { get; set; } | ||
public string Address1 { get; set; } | ||
public string Address2 { get; set; } | ||
public string City { get; set; } | ||
public string State { get; set; } | ||
public string PostalCode { get; set; } | ||
public string Name { get; set; } | ||
public string PhoneNumber { get; set; } | ||
public string Country { get; set; } | ||
} | ||
|
||
[JsonSerializable] | ||
public class ActiveOrUpcomingEvent | ||
{ | ||
public int Id { get; set; } | ||
public string ImageUrl { get; set; } | ||
public string Name { get; set; } | ||
public string CampaignName { get; set; } | ||
public string CampaignManagedOrganizerName { get; set; } | ||
public string Description { get; set; } | ||
public DateTimeOffset StartDate { get; set; } | ||
public DateTimeOffset EndDate { get; set; } | ||
} | ||
|
||
[JsonSerializable] | ||
public class CampaignSummaryViewModel | ||
{ | ||
public int Id { get; set; } | ||
public string Title { get; set; } | ||
public string Description { get; set; } | ||
public string ImageUrl { get; set; } | ||
public string OrganizationName { get; set; } | ||
public string Headline { get; set; } | ||
} | ||
|
||
[JsonSerializable] | ||
public class IndexViewModel | ||
{ | ||
public List<ActiveOrUpcomingEvent> ActiveOrUpcomingEvents { get; set; } | ||
public CampaignSummaryViewModel FeaturedCampaign { get; set; } | ||
public bool IsNewAccount { get; set; } | ||
public bool HasFeaturedCampaign => FeaturedCampaign != null; | ||
} | ||
|
||
[JsonSerializable] | ||
public class WeatherForecastWithPOCOs | ||
{ | ||
public DateTimeOffset Date { get; set; } | ||
public int TemperatureCelsius { get; set; } | ||
public string Summary { get; set; } | ||
public string SummaryField; | ||
public List<DateTimeOffset> DatesAvailable { get; set; } | ||
public Dictionary<string, HighLowTemps> TemperatureRanges { get; set; } | ||
public string[] SummaryWords { get; set; } | ||
} | ||
|
||
public class HighLowTemps | ||
{ | ||
public int High { get; set; } | ||
public int Low { get; set; } | ||
} | ||
|
||
} |
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
Oops, something went wrong.