Skip to content

Commit 0eb43e9

Browse files
committed
Make Compiler.resolveIn use RT.classForName as a last-ditch attempt when the symbol name contains special characters.
1 parent d7c8382 commit 0eb43e9

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

Clojure/Clojure/CljCompiler/Compiler.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -639,8 +639,17 @@ private static object ResolveIn(Namespace n, Symbol symbol, bool allowPrivate)
639639
return compiledType;
640640
}
641641

642-
if (o == null)
642+
if (o is null)
643643
{
644+
// Last chance: if there are any special characters that might be recognized by the typename resolver, give that a shot.
645+
if (symbol.Name.IndexOfAny(RT._triggerTypeChars) != -1)
646+
{
647+
var t = RT.classForName(symbol.Name);
648+
if (t is not null)
649+
return t;
650+
}
651+
652+
644653
if (RT.booleanCast(RT.AllowUnresolvedVarsVar.deref()))
645654
return symbol;
646655
else

Clojure/Clojure/Lib/RT.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2819,7 +2819,7 @@ public static string PrintToConsole(object x)
28192819
return names;
28202820
});
28212821

2822-
static readonly char[] _triggerTypeChars = ['`', ',', '[', '&', '<'];
2822+
internal static readonly char[] _triggerTypeChars = ['`', ',', '[', '&', '*'];
28232823

28242824
public static Type classForName(string p)
28252825
{

0 commit comments

Comments
 (0)