Internal type in the global namespace of a referenced assembly shadows other referenced public members

オープン
#20,892 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 3 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
45/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
領域
compilers

調査の方向性

Start by running the provided F# repro with and without the referenced assembly, then trace compiler name resolution for unqualified expression identifiers and inaccessible types from referenced assemblies. Done means the unqualified id resolves to Operators.id and the repro prints [1; 3] with the assembly referenced.

索引モデルが issue の本文から書いたものです。

説明

Bug Needs-Triage

When a referenced assembly contains an internal top-level type named id in the global namespace, an unqualified id in my code no longer resolves to Operators.id. It resolves to the inaccessible type instead.

Repro:
#r "nuget: c1.win.input,10.0.20262.832" // just to pull the package
#r @"%USERPROFILE%\.nuget\packages\c1.win.input\10.0.20262.832\lib\net10.0-windows7.0\C1.Win.Input.10.dll" // change %USERPROFILE% to the actual path 

let xs = [ Some 1; None; Some 3 ] |> Seq.choose id |> Seq.toList
printfn "%A" xs
Actual:

error FS0001: This expression was expected to have type 'int option' but here has type 'unit'

In a project build, the same code gives error FS0801: This type has no accessible object constructors.

Expected:

[1; 3]

Without the assembly being referenced, the script prints [1; 3].

An inaccessible type from another assembly shouldn’t take part in name resolution for an ordinary expression identifier.

Workaround:

Use qualified names.

主要言語
F#
スター
4.3k
フォーク
883
平均マージ
3日 13時間
マージ済み PR(30日)
108

環境構築

Codespaces で開く

このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

dotnet/fsharp のほかの issue

dotnet/fsharp の issue をすべて見る

似ている issue

Compilers の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。