Skip to content

Commit a832916

Browse files
committed
Psi/types: use module for symbol scope context
1 parent b2be3d5 commit a832916

File tree

5 files changed

+9
-9
lines changed

5 files changed

+9
-9
lines changed

ReSharper.FSharp/src/FSharp.Common/src/Shim/AssemblyReader/ProjectFcsModuleReader.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,7 @@ type ProjectFcsModuleReader(psiModule: IPsiModule, cache: FcsModuleReaderCommonC
466466
mkType declaredType ]
467467

468468
let mkCompilerGeneratedAttribute (attrTypeName: IClrTypeName) (args: ILAttribElem list): ILAttribute option =
469-
let attrType = TypeFactory.CreateTypeByCLRName(attrTypeName, NullableAnnotation.Unknown, psiModule)
469+
let attrType = TypeFactory.CreateTypeByCLRName(attrTypeName, psiModule, true)
470470

471471
match attrType.GetTypeElement() with
472472
| null -> None

ReSharper.FSharp/src/FSharp.Psi/src/Impl/FSharpAttributeInstance.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public FSharpAttributeInstance(FSharpAttribute attr, IPsiModule module)
2929
public string GetAttributeShortName() => Attr.AttributeType.DisplayName;
3030

3131
// todo: containing type type parameters?
32-
public IDeclaredType GetAttributeType() => TypeFactory.CreateTypeByCLRName(Attr.GetClrName(), Module);
32+
public IDeclaredType GetAttributeType() => TypeFactory.CreateTypeByCLRName(Attr.GetClrName(), Module, true);
3333

3434
private AttributeValue GetArgValue(Tuple<FSharpType, object> arg) =>
3535
new(ConstantValue.Create(arg.Item2, arg.Item1.MapType(EmptyList<ITypeParameter>.Instance, Module)));

ReSharper.FSharp/src/FSharp.Psi/src/Impl/FSharpProvidedAttributeInstance.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public FSharpProvidedAttributeInstance(RdCustomAttributeData data, IPsiModule mo
3030

3131
public string GetAttributeShortName() => myClrTypeName.ShortName;
3232

33-
public IDeclaredType GetAttributeType() => TypeFactory.CreateTypeByCLRName(myData.FullName, myModule);
33+
public IDeclaredType GetAttributeType() => TypeFactory.CreateTypeByCLRName(myData.FullName, myModule, true);
3434

3535
public AttributeValue PositionParameter(int paramIndex) =>
3636
paramIndex < PositionParameterCount
@@ -66,14 +66,14 @@ public IEnumerable<Pair<string, AttributeValue>> NamedParameters() => myData.Nam
6666

6767
private AttributeValue ConvertToAttributeValue(RdAttributeArg arg)
6868
{
69-
var elementType = TypeFactory.CreateTypeByCLRName(arg.TypeName, myModule);
69+
var elementType = TypeFactory.CreateTypeByCLRName(arg.TypeName, myModule, true);
7070

7171
if (!arg.IsArray) return new AttributeValue(ConstantValue.Create(arg.Unbox(), elementType));
7272

7373
var arrayType = TypeFactory.CreateArrayType(elementType, 1, NullableAnnotation.Unknown);
7474
return new AttributeValue(arrayType, arg.Values
7575
.Select(t =>
76-
new AttributeValue(ConstantValue.Create(t.Unbox(), TypeFactory.CreateTypeByCLRName(t.TypeName, myModule))))
76+
new AttributeValue(ConstantValue.Create(t.Unbox(), TypeFactory.CreateTypeByCLRName(t.TypeName, myModule, true))))
7777
.ToArray());
7878
}
7979
}

ReSharper.FSharp/src/FSharp.Psi/src/Util/FcsSymbolMappingUtil.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ private static IDeclaredElement GetDeclaredElement(FSharpUnionCase unionCase, IP
220220
return caseMember;
221221

222222
var unionClrName = unionTypeElement.GetClrName();
223-
var caseDeclaredType = TypeFactory.CreateTypeByCLRName(unionClrName + "+" + caseCompiledName, psiModule);
223+
var caseDeclaredType = TypeFactory.CreateTypeByCLRName(unionClrName + "+" + caseCompiledName, psiModule, true);
224224
return caseDeclaredType.GetTypeElement();
225225
}
226226

ReSharper.FSharp/src/FSharp.Psi/src/Util/FcsTypeMappingUtil.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ public static IType MapType([NotNull] this ProvidedType providedType, IPsiModule
212212
return TypeFactory.CreatePointerType(providedType.GetElementType().MapType(module));
213213

214214
if (!providedType.IsGenericType)
215-
return TypeFactory.CreateTypeByCLRName(proxyProvidedType.GetClrName(), NullableAnnotation.Unknown, module);
215+
return TypeFactory.CreateTypeByCLRName(proxyProvidedType.GetClrName(), module, true);
216216

217217
if (providedType.GetGenericTypeDefinition() is not IProxyProvidedType genericTypeDefinition)
218218
{
@@ -221,7 +221,7 @@ public static IType MapType([NotNull] this ProvidedType providedType, IPsiModule
221221
}
222222

223223
var typeDefinition =
224-
TypeFactory.CreateTypeByCLRName(genericTypeDefinition.GetClrName(), NullableAnnotation.Unknown, module);
224+
TypeFactory.CreateTypeByCLRName(genericTypeDefinition.GetClrName(), module, true);
225225

226226
var genericProvidedArgs = providedType.GetGenericArguments();
227227
var genericTypes = new IType[genericProvidedArgs.Length];
@@ -359,6 +359,6 @@ public static IType GetExpressionTypeFromFcs([NotNull] this IFSharpTreeNode fsTr
359359
[NotNull]
360360
public static IDeclaredType CreateTypeByClrName([NotNull] this IClrTypeName clrTypeName,
361361
[NotNull] IPsiModule psiModule) =>
362-
TypeFactory.CreateTypeByCLRName(clrTypeName, NullableAnnotation.Unknown, psiModule);
362+
TypeFactory.CreateTypeByCLRName(clrTypeName, psiModule, true);
363363
}
364364
}

0 commit comments

Comments
 (0)