Skip to content

Commit 6647e1a

Browse files
committed
Ignore special tags (int, long, etc) at top level in ClrTypeSpec2.Resolve
1 parent f1a3470 commit 6647e1a

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

Clojure/Clojure/Lib/ClrTypeSpec2.cs

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -783,9 +783,11 @@ static ClrTypeSpec Parse(string name, ref int p, bool is_recurse, bool allow_aqn
783783

784784
public Type Resolve(
785785
Func<AssemblyName, Assembly> assemblyResolver,
786-
Func<Assembly, string, bool, Type> typeResolver,
786+
Func<Assembly, string, bool, bool, Type> typeResolver,
787787
bool throwOnError,
788-
bool ignoreCase /*, ref System.Threading.StackCrawlMark stackMark*/)
788+
bool ignoreCase,
789+
bool allowSpecialTags
790+
/*, ref System.Threading.StackCrawlMark stackMark*/)
789791
{
790792
Assembly asm = null;
791793

@@ -813,7 +815,7 @@ public Type Resolve(
813815

814816
Type type = null;
815817
if (typeResolver is not null)
816-
type = typeResolver(asm, _name.DisplayName, ignoreCase);
818+
type = typeResolver(asm, _name.DisplayName, ignoreCase, allowSpecialTags);
817819
else
818820
type = asm.GetType(_name.DisplayName, false, ignoreCase);
819821

@@ -823,7 +825,7 @@ public Type Resolve(
823825
if (!arityName.Equals(_name.DisplayName))
824826
{
825827
if (typeResolver is not null)
826-
type = typeResolver(asm, arityName, ignoreCase);
828+
type = typeResolver(asm, arityName, ignoreCase, allowSpecialTags);
827829
else
828830
type = asm.GetType(arityName, false, ignoreCase);
829831
}
@@ -858,7 +860,7 @@ public Type Resolve(
858860
Type[] args = new Type[_genericParams.Count];
859861
for (int i = 0; i < args.Length; ++i)
860862
{
861-
var tmp = _genericParams[i].Resolve(assemblyResolver, typeResolver, throwOnError, ignoreCase /*, ref stackMark */);
863+
var tmp = _genericParams[i].Resolve(assemblyResolver, typeResolver, throwOnError, ignoreCase, true /*, ref stackMark */);
862864
if (tmp is null)
863865
{
864866
if (throwOnError)
@@ -883,13 +885,13 @@ public Type Resolve(
883885
}
884886

885887

886-
private static Type DefaultTypeResolver(Assembly assembly, string typename, Namespace ns)
888+
private static Type DefaultTypeResolver(Assembly assembly, string typename, Namespace ns, bool allowSpecialTags)
887889
{
888890

889891
if (assembly is not null)
890892
return assembly.GetType(typename);
891893

892-
var type = HostExpr.maybeSpecialTag(Symbol.create(typename));
894+
var type = allowSpecialTags ? HostExpr.maybeSpecialTag(Symbol.create(typename)) : null;
893895

894896
// check for aliases in the namespace
895897
if (type is null && ns is not null)
@@ -925,7 +927,8 @@ public static Type GetTypeFromName(string name, Namespace ns = null)
925927
return null;
926928
return spec.Resolve(
927929
assyName => Assembly.Load(assyName),
928-
(assembly, typename, ignoreCase) => DefaultTypeResolver(assembly, typename, ns),
930+
(assembly, typename, ignoreCase, allowSpecialTags) => DefaultTypeResolver(assembly, typename, ns, allowSpecialTags),
931+
false,
929932
false,
930933
false);
931934
}

0 commit comments

Comments
 (0)