Skip to content

Commit

Permalink
Fix for implicit numeric conversion from sbyte to float
Browse files Browse the repository at this point in the history
  • Loading branch information
MerlinVR committed Mar 24, 2020
1 parent 37bd8c7 commit e3773f6
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions Assets/UdonSharp/Editor/UdonSharpUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public static bool HasModifier(this SyntaxTokenList syntaxTokens, string modifie
// https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/language-specification/conversions#implicit-numeric-conversions
private static readonly IReadOnlyDictionary<System.Type, System.Type[]> implicitBuiltinConversions = new Dictionary<System.Type, System.Type[]>()
{
{ typeof(sbyte), new System.Type[] { typeof(short), typeof(int), typeof(long), typeof(double), typeof(decimal) } },
{ typeof(sbyte), new System.Type[] { typeof(short), typeof(int), typeof(long), typeof(float), typeof(double), typeof(decimal) } },
{ typeof(byte), new System.Type[] { typeof(short), typeof(ushort), typeof(int), typeof(uint), typeof(long), typeof(ulong), typeof(float), typeof(double), typeof(decimal) } },
{ typeof(short), new System.Type[] { typeof(int), typeof(long), typeof(float), typeof(double), typeof(decimal) } },
{ typeof(ushort), new System.Type[] { typeof(int), typeof(uint), typeof(long), typeof(ulong), typeof(float), typeof(double), typeof(decimal) } },
Expand Down Expand Up @@ -368,11 +368,16 @@ public static bool IsUserDefinedBehaviour(System.Type type)
type.IsSubclassOf(typeof(UdonSharpBehaviour)) ||
(type.IsArray && (type.GetElementType().IsSubclassOf(typeof(UdonSharpBehaviour)) || type.GetElementType() == typeof(UdonSharpBehaviour)));
}

public static bool IsUserJaggedArray(System.Type type)
{
return type.IsArray && type.GetElementType().IsArray;
}

public static bool IsUserDefinedType(System.Type type)
{
return IsUserDefinedBehaviour(type) ||
type.IsArray && type.GetElementType().IsArray; // Jagged arrays
IsUserJaggedArray(type);
}

private static Dictionary<System.Type, System.Type> userTypeToUdonTypeCache = new Dictionary<System.Type, System.Type>();
Expand Down

0 comments on commit e3773f6

Please sign in to comment.