-
-
Notifications
You must be signed in to change notification settings - Fork 742
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(weaver): Warning for multiple write/read functions for the same t…
…ype (#2453) * fix(weaver): Warning for multiple write/read functions for the same type Adding warning message when trying to register a write or read function for a type that is already in dictionary. Previously weaver would be silent about this making it hard to know when an extension method overrides another one. * test for warnings
- Loading branch information
1 parent
fd9a7b0
commit 301e791
Showing
5 changed files
with
57 additions
and
1 deletion.
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
32 changes: 32 additions & 0 deletions
32
...r/WeaverGeneratedReaderWriterTests~/GivesWarningWhenRegisteringExistingExtensionMethod.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,32 @@ | ||
using Mirror; | ||
|
||
namespace GeneratedReaderWriter.GivesWarningWhenRegisteringExistingExtensionMethod | ||
{ | ||
public struct MyType | ||
{ | ||
public int number; | ||
} | ||
|
||
public static class ReadWriteExtension | ||
{ | ||
public static void WriteMyType(this NetworkWriter writer, MyType data) | ||
{ | ||
writer.WriteInt32(data.number); | ||
} | ||
|
||
public static void WriteMyType2(this NetworkWriter writer, MyType data) | ||
{ | ||
writer.WriteInt32(data.number); | ||
} | ||
|
||
public static MyType ReadMyType(this NetworkReader reader) | ||
{ | ||
return new MyType { number = reader.ReadInt32() }; | ||
} | ||
|
||
public static MyType ReadMyType2(this NetworkReader reader) | ||
{ | ||
return new MyType { number = reader.ReadInt32() }; | ||
} | ||
} | ||
} |