未验证 提交 a4e2fff3 编写于 作者: D dotnet bot 提交者: GitHub

Merge pull request #14438 from dotnet/merges/main-to-release/dev17.5

Merge main to release/dev17.5
......@@ -2693,6 +2693,7 @@ let rec ResolveLongIdentInTypePrim (ncenv: NameResolver) nenv lookupKind (resInf
match nestedSearchAccessible with
| Result res when not (isNil res) -> nestedSearchAccessible
| Exception _ -> nestedSearchAccessible
| _ ->
let suggestMembers (addToBuffer: string -> unit) =
for p in ExtensionPropInfosOfTypeInScope ResultCollectionSettings.AllResults ncenv.InfoReader nenv None LookupIsInstance.Ambivalent ad m ty do
......
......@@ -178,6 +178,7 @@
<Compile Include="Language\ExtensionMethodTests.fs" />
<Compile Include="ConstraintSolver\PrimitiveConstraints.fs" />
<Compile Include="ConstraintSolver\MemberConstraints.fs" />
<Compile Include="Interop\DeeplyNestedCSharpClasses.fs" />
<Compile Include="Interop\SimpleInteropTests.fs" />
<Compile Include="Interop\RequiredAndInitOnlyProperties.fs" />
<Compile Include="Interop\StaticsInInterfaces.fs" />
......@@ -214,6 +215,9 @@
<Compile Include="FSharpChecker\CommonWorkflows.fs" />
<Compile Include="FSharpChecker\SymbolUse.fs" />
<Compile Include="FSharpChecker\FindReferences.fs" />
</ItemGroup>
<ItemGroup>
<None Include="**\*.cs;**\*.fs;**\*.fsx;**\*.fsi" Exclude="@(Compile)">
<Link>%(RelativeDir)\TestSource\%(Filename)%(Extension)</Link>
</None>
......
// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information.
namespace FSharp.Compiler.ComponentTests.Interop
open Xunit
open FSharp.Test.Compiler
open FSharp.Test
open System
module ``Deeply nested CSharpClasses`` =
let cslib =
CSharp """
using System;
namespace MyNamespace
{
public class OuterClass
{
public class InnerClass
{
public class MoreInnerClass
{
public static void somefunction() { }
}
}
}
}"""
[<Fact>]
let ``Missing type outerclass generates good message and range`` () =
let fsharpSource =
"""
let loss2 = MyNamespace.OoterClass.InnerClass.MoreInnerClass.somefunction() //Note the miss-typed functionname we expect a good error message
"""
FSharp fsharpSource
|> asExe
|> withReferences [cslib]
|> compile
|> withSingleDiagnostic (Error 39, Line 2, Col 25, Line 2, Col 35, "The value, constructor, namespace or type 'OoterClass' is not defined. Maybe you want one of the following:
OuterClass")
[<Fact>]
let ``Missing type nested type innerclass generates good message and range`` () =
let fsharpSource =
"""
let loss2 = MyNamespace.OuterClass.InerClass.MoreInnerClass.somefunction() //Note the miss-typed InnerClass name we expect a good error message
"""
FSharp fsharpSource
|> asExe
|> withReferences [cslib]
|> compile
|> shouldFail
|> withSingleDiagnostic (Error 39, Line 2, Col 36, Line 2, Col 45, "The type 'OuterClass' does not define the field, constructor or member 'InerClass'.")
[<Fact>]
let ``Missing type nested type moreinnerclass generates good message and range`` () =
let fsharpSource =
"""
let loss2 = MyNamespace.OuterClass.InnerClass.MoareInnerClass.somefunction() //Note the miss-typed MoreInnerClass we expect a good error message
"""
FSharp fsharpSource
|> asExe
|> withReferences [cslib]
|> compile
|> shouldFail
|> withSingleDiagnostic (Error 39, Line 2, Col 47, Line 2, Col 62, "The type 'InnerClass' does not define the field, constructor or member 'MoareInnerClass'.")
[<Fact>]
let ``Missing function generates good message and range`` () =
let fsharpSource =
"""
let loss2 = MyNamespace.OuterClass.InnerClass.MoreInnerClass.somefunctoion() //Note the miss-typed somefunction we expect a good error message
"""
FSharp fsharpSource
|> asExe
|> withReferences [cslib]
|> compile
|> shouldFail
|> withSingleDiagnostic ((Error 39, Line 2, Col 62, Line 2, Col 75, """The type 'MoreInnerClass' does not define the field, constructor or member 'somefunctoion'. Maybe you want one of the following:
somefunction"""))
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册