|
14 | 14 | using AXSharp.Compiler.Cs.Helpers; |
15 | 15 | using AXSharp.Connector; |
16 | 16 |
|
| 17 | + |
17 | 18 | namespace AXSharp.Compiler.Cs; |
18 | 19 |
|
19 | 20 | /// <summary> |
@@ -76,15 +77,26 @@ public static ITypeDeclaration FindTypeDeclaration(this Compilation compilation, |
76 | 77 | return candidates.First(); |
77 | 78 | } |
78 | 79 |
|
79 | | - if (candidates.Count() == 0) |
| 80 | + try |
80 | 81 | { |
81 | | - Log.Logger.Warning($"Type '{typeAccess?.ToString()}' not found in the semantic tree."); |
82 | | - } |
| 82 | + var span = typeAccess?.Location?.GetLineSpan(); |
| 83 | + var line = span.Value.StartLinePosition.Line; |
| 84 | + var character = span.Value.StartLinePosition.Character; |
| 85 | + if (candidates.Count() == 0) |
| 86 | + { |
| 87 | + Log.Logger.Warning($"{span?.Filename}({line}:{character}) : Type '{typeAccess.TypeSymbol.Name}' not found the type may not be eligible for transpile or meta information is not available because this type is not defined in AX# compliant project. "); |
| 88 | + } |
83 | 89 |
|
84 | | - if (candidates.Count() > 1) |
| 90 | + if (candidates.Count() > 1) |
| 91 | + { |
| 92 | + Log.Logger.Warning($"{span?.Filename}({line}:{character}) : Multiple types found for '{typeAccess.TypeSymbol.Name}' the declaration appears ambiguous. You may need to fully qualify the declaration."); |
| 93 | + } |
| 94 | + } |
| 95 | + catch |
85 | 96 | { |
86 | | - Log.Logger.Warning($"Multiple types found for '{typeAccess?.ToString()}' in the semantic tree. You may need to fully qualify the declaration."); |
| 97 | + Log.Logger.Warning($"Failed to determine the location of the type declaration for `{typeAccess?.TypeSymbol?.Name}`."); |
87 | 98 | } |
| 99 | + |
88 | 100 |
|
89 | 101 | return null; |
90 | 102 | } |
@@ -113,7 +125,7 @@ public static ITypeDeclaration FindTypeDeclaration(this Compilation compilation, |
113 | 125 |
|
114 | 126 | if (candidates.Count() == 0) |
115 | 127 | { |
116 | | - Log.Logger.Warning($"Type '{typeAccess?.ToString()}' not found in the semantic tree."); |
| 128 | + Log.Logger.Warning($"Type '{typeAccess?.ToString()}' not found in the semantic tree. {typeAccess?.Location}"); |
117 | 129 | } |
118 | 130 |
|
119 | 131 | if (candidates.Count() > 1) |
|
0 commit comments