Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Add additional test and fix exposed error in nested generic types.
  • Loading branch information
jpobst committed Jan 6, 2020
commit 95698bcc3ddc08e3ef7c46168f5f6ebcc5b0fe1d
10 changes: 6 additions & 4 deletions tests/generator-Tests/Unit-Tests/SymbolTableTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,13 @@ public void FindGenericTypes ()

table.AddType (dict);

Assert.NotNull (table.Lookup ("System.Collections.Generic.IList<Java.Util.Locale.LanguageRange>"));
Assert.NotNull (table.Lookup ("System.Collections.Generic.IList<List<Java.Util.Locale.LanguageRange>>"));
Assert.AreEqual ("System.Collections.Generic.IList`1", table.Lookup ("System.Collections.Generic.IList<Java.Util.Locale.LanguageRange>").FullName);
Assert.AreEqual ("System.Collections.Generic.IList`1", table.Lookup ("System.Collections.Generic.IList<List<Java.Util.Locale.LanguageRange>>").FullName);

Assert.NotNull (table.Lookup ("System.Collections.Generic.IDictionary<string, Java.Util.Locale.LanguageRange>"));
Assert.NotNull (table.Lookup ("System.Collections.Generic.IDictionary<string, List<Java.Util.Locale.LanguageRange>>"));
Assert.AreEqual ("System.Collections.Generic.IDictionary`2", table.Lookup ("System.Collections.Generic.IDictionary<string, Java.Util.Locale.LanguageRange>").FullName);
Assert.AreEqual ("System.Collections.Generic.IDictionary`2", table.Lookup ("System.Collections.Generic.IDictionary<string, List<Java.Util.Locale.LanguageRange>>").FullName);

Assert.AreEqual ("System.Collections.Generic.IList`1", table.Lookup ("System.Collections.Generic.IList<Dictionary<string, Java.Util.Locale.LanguageRange>>").FullName);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -311,21 +311,13 @@ private string AddArity (string key, string typeParams)
typeParams = typeParams.Substring (1, typeParams.Length - 2);

foreach (var c in typeParams) {
if (nested_count > 0) {
if (c == '>') {
nested_count--;
continue;
}

if (c == '<') {
nested_count++;
continue;
}
if (c == '>')
nested_count--;

continue;
}
if (c == '<')
nested_count++;

if (c == ',')
if (nested_count == 0 && c == ',')
arity++;
}

Expand Down