diff --git a/.gitignore b/.gitignore
index 236ddf853f2..a78b05f7c1b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,6 +3,11 @@
/packages
/Tools
+/tests/scripts/current
+/release
+/debug
+/Proto
+
# Patches that may have been generated by scripts.
# (These aren't generally useful to commit directly; if anything, they should be applied.)
scripts/*.patch
diff --git a/FSharp.sln b/FSharp.sln
index 0d41f990d73..9a3f8f5e6ff 100644
--- a/FSharp.sln
+++ b/FSharp.sln
@@ -31,7 +31,7 @@ Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "FSharp.Tests.FSharpSuite",
EndProject
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "FSharp.Compiler.UnitTests", "tests\FSharp.Compiler.UnitTests\FSharp.Compiler.UnitTests.fsproj", "{A8D9641A-9170-4CF4-8FE0-6DB8C134E1B5}"
EndProject
-Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "FSharp.Core.UnitTests", "tests\FSharp.Core.UnitTests\FSharp.Core.UnitTests.fsproj", "{88E2D422-6852-46E3-A740-83E391DC7973}"
+Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "FSharp.Core.UnitTests", "tests\FSharp.Core.UnitTests\FSharp.Core.Unittests.fsproj", "{88E2D422-6852-46E3-A740-83E391DC7973}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Compiler", "Compiler", "{3881429D-A97A-49EB-B7AE-A82BA5FE9C77}"
EndProject
diff --git a/Makefile b/Makefile
index d955b9e7580..b392dfe356f 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,6 @@
include $(topsrcdir)mono/config.make
-.PHONY: restore
+.PHONY: restore build
restore:
MONO_ENV_OPTIONS=$(monoopts) mono .nuget/NuGet.exe restore packages.config -PackagesDirectory packages -ConfigFile .nuget/NuGet.Config
@@ -27,7 +27,7 @@ build:
MONO_ENV_OPTIONS=$(monoopts) $(MSBUILD) /p:Configuration=$(Configuration) /p:TargetDotnetProfile=net40 src/fsharp/FSharp.Compiler.Server.Shared/FSharp.Compiler.Server.Shared.fsproj
MONO_ENV_OPTIONS=$(monoopts) $(MSBUILD) /p:Configuration=$(Configuration) /p:TargetDotnetProfile=net40 src/fsharp/fsi/Fsi.fsproj
MONO_ENV_OPTIONS=$(monoopts) $(MSBUILD) /p:Configuration=$(Configuration) /p:TargetDotnetProfile=net40 src/fsharp/fsiAnyCpu/FsiAnyCPU.fsproj
- MONO_ENV_OPTIONS=$(monoopts) $(MSBUILD) /p:Configuration=$(Configuration) /p:TargetDotnetProfile=net40 tests/FSharp.Core.UnitTests/FSharp.Core.UnitTests.fsproj
+ MONO_ENV_OPTIONS=$(monoopts) $(MSBUILD) /p:Configuration=$(Configuration) /p:TargetDotnetProfile=net40 tests/FSharp.Core.UnitTests/FSharp.Core.Unittests.fsproj
mkdir -p $(Configuration)/fsharp30/net40/bin
mkdir -p $(Configuration)/fsharp31/net40/bin
mkdir -p $(Configuration)/fsharp40/net40/bin
diff --git a/before_install.sh b/before_install.sh
index d1498a55e64..10f623a6b0d 100755
--- a/before_install.sh
+++ b/before_install.sh
@@ -32,7 +32,7 @@ fi
# We need to run the command twice -- on some systems (e.g. macOS) the certs are installed in the user store,
# and on other systems (e.g., Ubuntu) they're installed to the machine store. certmgr only shows what's in
# the selected store, which is why we need to check both.
-if [ "$(certmgr -list -c Trust | grep -c -F "X.509")" -le 1 ] && [ "$(certmgr -list -c -m Trust | grep -c -F "X.509")" -le 1 ]; then
+if [ $OS = 'Linux' ] && [ "$(certmgr -list -c Trust | grep -c -F "X.509")" -le 1 ] && [ "$(certmgr -list -c -m Trust | grep -c -F "X.509")" -le 1 ]; then
echo "No SSL certificates installed so unable to restore NuGet packages." >&2;
echo "Run 'mozroots --sync --import' to install certificates to Mono's certificate store." >&2;
exit 1
diff --git a/build-everything.proj b/build-everything.proj
index f236cde62cb..0d0cdea76c2 100644
--- a/build-everything.proj
+++ b/build-everything.proj
@@ -54,12 +54,12 @@
-
+
-
+
diff --git a/build.sh b/build.sh
index 2d15c1a934e..7c4c450c838 100755
--- a/build.sh
+++ b/build.sh
@@ -24,12 +24,11 @@ Build and run a subset of test suites
Usage:
-build.sh ^
+build.sh ^
^
- ^
^
^
- ^
+ ^
^
^
@@ -41,15 +40,11 @@ Other examples:
build.sh net40 (build compiler for .NET Framework)
build.sh coreclr (build compiler for .NET Core)
- build.sh vs (build Visual Studio IDE Tools)
build.sh all (build everything)
build.sh test (build and test default targets)
build.sh net40 test (build and test net40)
build.sh coreclr test (build and test net40)
- build.sh vs test (build and test net40)
build.sh all test (build and test net40)
- build.sh nobuild test include Conformance (run only tests marked with Conformance category)
- build.sh nobuild test include Expensive (run only tests marked with Expensive category)
"
@@ -84,8 +79,6 @@ export BUILD_PHASE=1
export BUILD_NET40_FSHARP_CORE=0
export BUILD_NET40=0
export BUILD_CORECLR=0
-export BUILD_PORTABLE=0
-export BUILD_VS=0
export BUILD_CONFIG=release
export BUILD_CONFIG_LOWERCASE=release
export BUILD_DIAG=
@@ -94,11 +87,8 @@ export BUILD_PUBLICSIGN=0
export TEST_NET40_COMPILERUNIT_SUITE=0
export TEST_NET40_COREUNIT_SUITE=0
export TEST_NET40_FSHARP_SUITE=0
-export TEST_NET40_FSHARPQA_SUITE=0
export TEST_CORECLR_COREUNIT_SUITE=0
export TEST_CORECLR_FSHARP_SUITE=0
-export TEST_PORTABLE_COREUNIT_SUITE=0
-export TEST_VS_IDEUNIT_SUITE=0
export INCLUDE_TEST_SPEC_NUNIT=
export INCLUDE_TEST_TAGS=
@@ -123,19 +113,6 @@ do
export BUILD_PROTO_WITH_CORECLR_LKG=1
export BUILD_CORECLR=1
;;
- "pcls")
- _autoselect=0
- export BUILD_PORTABLE=1
- ;;
- "vs")
- _autoselect=0
- export BUILD_NET40=1
- export BUILD_NET40_FSHARP_CORE=1
- export BUILD_VS=1
- ;;
- "vstest")
- export TEST_VS_IDEUNIT_SUITE=1
- ;;
"nobuild")
export BUILD_PHASE=0
;;
@@ -151,88 +128,11 @@ do
export BUILD_NET40=1
export BUILD_NET40_FSHARP_CORE=1
export BUILD_CORECLR=1
- export BUILD_PORTABLE=1
- export BUILD_VS=1
- export BUILD_SETUP=$FSC_BUILD_SETUP
- export CI=1
- ;;
- "microbuild")
- _autoselect=0
- export BUILD_PROTO=1
- export BUILD_NET40=1
- export BUILD_NET40_FSHARP_CORE=1
- export BUILD_PROTO_WITH_CORECLR_LKG=1
- export BUILD_CORECLR=1
- export BUILD_PORTABLE=1
export BUILD_VS=1
export BUILD_SETUP=$FSC_BUILD_SETUP
-
- export TEST_NET40_COMPILERUNIT_SUITE=1
- export TEST_NET40_COREUNIT_SUITE=1
- export TEST_NET40_FSHARP_SUITE=1
- export TEST_NET40_FSHARPQA_SUITE=1
- export TEST_CORECLR_COREUNIT_SUITE=0
- export TEST_CORECLR_FSHARP_SUITE=0
- export TEST_PORTABLE_COREUNIT_SUITE=1
- export TEST_VS_IDEUNIT_SUITE=1
- export CI=1
- ;;
-
- # These divide 'ci' into multiple chunks which can be done in parallel
- "ci_part1")
- _autoselect=0
-
- # what we do
- export BUILD_PROTO=1
- export BUILD_NET40=1
- export BUILD_NET40_FSHARP_CORE=1
- export BUILD_PORTABLE=1
- export BUILD_VS=1
- export BUILD_SETUP=$FSC_BUILD_SETUP
- export TEST_NET40_COMPILERUNIT_SUITE=1
- export TEST_NET40_FSHARPQA_SUITE=1
- export TEST_VS_IDEUNIT_SUITE=1
- export CI=1
- ;;
- "ci_part2")
- _autoselect=0
-
- # what we do
- export BUILD_PROTO_WITH_CORECLR_LKG=1
- export BUILD_PROTO=1
- export BUILD_NET40=1
- export BUILD_NET40_FSHARP_CORE=1
- export BUILD_PORTABLE=1
-
- export TEST_NET40_COREUNIT_SUITE=1
- export TEST_NET40_FSHARP_SUITE=1
- export TEST_PORTABLE_COREUNIT_SUITE=1
- export CI=1
- ;;
- "ci_part3")
- _autoselect=0
-
- # what we do
- export BUILD_PROTO_WITH_CORECLR_LKG=1
- export BUILD_PROTO=1
- export BUILD_NET40=1
- export BUILD_NET40_FSHARP_CORE=1
- export BUILD_CORECLR=1
-
- export TEST_CORECLR_FSHARP_SUITE=1
- export TEST_CORECLR_COREUNIT_SUITE=1
export CI=1
;;
- # TEMP: The Jenkins builds currently call this script with the 'ci' target,
- # but that doesn't exist even in build.cmd. It wasn't doing anything
- # before anyway, so accept 'ci' but ignore it for now because the test
- # suites don't build correctly on Linux/macOS yet anyway.
- "ci")
- # TODO: Do everything from ci_part1-3 here.
- printf "The 'ci' target is currently ignored, until the test suite builds can be fixed for Linux/macOS.\n"
- ;;
-
"proto")
export BUILD_PROTO=1
;;
@@ -254,12 +154,6 @@ do
"no-test")
no_test=1
;;
- "include")
- failwith "The 'include' option is not (yet) supported by this script."
- #export /a counter=!counter!+1
- #if '$INCLUDE_TEST_SPEC_NUNIT' == '' ( export INCLUDE_TEST_SPEC_NUNIT=cat == $ARG2 ) else (set INCLUDE_TEST_SPEC_NUNIT=cat == $ARG2 or $INCLUDE_TEST_SPEC_NUNIT )
- #if '$INCLUDE_TEST_TAGS' == '' ( export INCLUDE_TEST_TAGS=$ARG2 ) else (set INCLUDE_TEST_TAGS=$ARG2;$INCLUDE_TEST_TAGS )
- ;;
"test-all")
_autoselect=0
export BUILD_PROTO=1
@@ -267,23 +161,12 @@ do
export BUILD_NET40=1
export BUILD_NET40_FSHARP_CORE=1
export BUILD_CORECLR=1
- export BUILD_PORTABLE=1
- export BUILD_VS=1
export BUILD_SETUP=$FSC_BUILD_SETUP
export TEST_NET40_COMPILERUNIT_SUITE=1
export TEST_NET40_COREUNIT_SUITE=1
export TEST_NET40_FSHARP_SUITE=1
- export TEST_NET40_FSHARPQA_SUITE=1
- export TEST_PORTABLE_COREUNIT_SUITE=1
export TEST_CORECLR_COREUNIT_SUITE=1
- export TEST_VS_IDEUNIT_SUITE=1
- ;;
- "test-net40-fsharpqa")
- export BUILD_NET40=1
- export BUILD_NET40_FSHARP_CORE=1
- export BUILD_PORTABLE=1
- export TEST_NET40_FSHARPQA_SUITE=1
;;
"test-compiler-unit")
export BUILD_NET40=1
@@ -299,14 +182,9 @@ do
export BUILD_CORECLR=1
export TEST_CORECLR_COREUNIT_SUITE=1
;;
- "test-pcl-coreunit")
- export BUILD_PORTABLE=1
- export TEST_PORTABLE_COREUNIT_SUITE=1
- ;;
"test-net40-fsharp")
export BUILD_NET40=1
export BUILD_NET40_FSHARP_CORE=1
- export BUILD_PORTABLE=1
export TEST_NET40_FSHARP_SUITE=1
;;
"test-coreclr-fsharp")
@@ -329,50 +207,43 @@ do
esac
done
-if [ $_buildexit -eq 1 ]; then
+if [ "$_buildexit" = "1" ]; then
exit $_buildexitvalue
fi
# Apply defaults, if necessary.
-if [ $_autoselect -eq 1 ]; then
+if [ "$_autoselect" = "1" ]; then
export BUILD_NET40=1
export BUILD_NET40_FSHARP_CORE=1
fi
-if [ $_autoselect_tests -eq 1 ]; then
- if [ $BUILD_NET40 -eq 1 ]; then
+if [ "$_autoselect_tests" = "1" ]; then
+ if [ "$BUILD_NET40" = "1" ]; then
export TEST_NET40_COMPILERUNIT_SUITE=1
- export TEST_NET40_COREUNIT_SUITE=1
- export TEST_NET40_FSHARP_SUITE=1
- export TEST_NET40_FSHARPQA_SUITE=1
+
+ # This requires a build of FSharp.Core.dll?
+ # export TEST_NET40_COREUNIT_SUITE=1
+
+ # This requires a lot more work to get running on OSX/Linux
+ # export TEST_NET40_FSHARP_SUITE=1
fi
- if [ $BUILD_CORECLR -eq 1 ]; then
+ if [ "$BUILD_CORECLR" = "1" ]; then
export BUILD_NET40=1
export BUILD_NET40_FSHARP_CORE=1
export TEST_CORECLR_FSHARP_SUITE=1
export TEST_CORECLR_COREUNIT_SUITE=1
fi
- if [ $BUILD_PORTABLE -eq 1 ]; then
- export TEST_PORTABLE_COREUNIT_SUITE=1
- fi
-
- if [ $BUILD_VS -eq 1 ]; then
- export TEST_VS_IDEUNIT_SUITE=1
- fi
fi
# If the `PB_SKIPTESTS` variable is set to 'true' then no tests should be built or run, even if explicitly specified
-if [ $PB_SKIPTESTS -eq "true" ]; then
+if [ "$PB_SKIPTESTS" = "true" ]; then
export TEST_NET40_COMPILERUNIT_SUITE=0
export TEST_NET40_COREUNIT_SUITE=0
export TEST_NET40_FSHARP_SUITE=0
- export TEST_NET40_FSHARPQA_SUITE=0
export TEST_CORECLR_COREUNIT_SUITE=0
export TEST_CORECLR_FSHARP_SUITE=0
- export TEST_PORTABLE_COREUNIT_SUITE=0
- export TEST_VS_IDEUNIT_SUITE=0
fi
#
@@ -386,8 +257,6 @@ printf "BUILD_PROTO_WITH_CORECLR_LKG=%s\n" "$BUILD_PROTO_WITH_CORECLR_LKG"
printf "BUILD_NET40=%s\n" "$BUILD_NET40"
printf "BUILD_NET40_FSHARP_CORE=%s\n" "$BUILD_NET40_FSHARP_CORE"
printf "BUILD_CORECLR=%s\n" "$BUILD_CORECLR"
-printf "BUILD_PORTABLE=%s\n" "$BUILD_PORTABLE"
-printf "BUILD_VS=%s\n" "$BUILD_VS"
printf "BUILD_SETUP=%s\n" "$BUILD_SETUP"
printf "BUILD_CONFIG=%s\n" "$BUILD_CONFIG"
printf "BUILD_PUBLICSIGN=%s\n" "$BUILD_PUBLICSIGN"
@@ -398,21 +267,12 @@ printf "\n"
printf "TEST_NET40_COMPILERUNIT_SUITE=%s\n" "$TEST_NET40_COMPILERUNIT_SUITE"
printf "TEST_NET40_COREUNIT_SUITE=%s\n" "$TEST_NET40_COREUNIT_SUITE"
printf "TEST_NET40_FSHARP_SUITE=%s\n" "$TEST_NET40_FSHARP_SUITE"
-printf "TEST_NET40_FSHARPQA_SUITE=%s\n" "$TEST_NET40_FSHARPQA_SUITE"
printf "TEST_CORECLR_COREUNIT_SUITE=%s\n" "$TEST_CORECLR_COREUNIT_SUITE"
printf "TEST_CORECLR_FSHARP_SUITE=%s\n" "$TEST_CORECLR_FSHARP_SUITE"
-printf "TEST_PORTABLE_COREUNIT_SUITE=%s\n" "$TEST_PORTABLE_COREUNIT_SUITE"
-printf "TEST_VS_IDEUNIT_SUITE=%s\n" "$TEST_VS_IDEUNIT_SUITE"
printf "INCLUDE_TEST_SPEC_NUNIT=%s\n" "$INCLUDE_TEST_SPEC_NUNIT"
printf "INCLUDE_TEST_TAGS=%s\n" "$INCLUDE_TEST_TAGS"
printf "\n"
-# TODO: Print out environment variables?
-printf "Environment\n"
-printf "\n"
-printf "(TODO)\n"
-printf "\n"
-printf "\n"
build_status "Done with arguments, starting preparation"
@@ -422,7 +282,7 @@ msbuildflags=""
# Perform any necessary setup and system configuration prior to running builds.
./before_install.sh
rc=$?;
-if [ $rc -ne 0 ]; then
+if [ "$rc" != "0" ]; then
printf "before_install script failed.\n"
exit $rc
fi
@@ -458,23 +318,10 @@ if [ "${RestorePackages:-true}" = 'true' ]; then
failwith "Nuget restore failed"
fi
- if [ "$BUILD_VS" = '1' ]; then
- eval "$_nugetexe restore vsintegration/packages.config $_nugetoptions"
- if [ $? -ne 0 ]; then
- failwith "Nuget restore failed"
- fi
- fi
-
- if [ "$BUILD_SETUP" = '1' ]; then
- eval "$_nugetexe restore setup/packages.config $_nugetoptions"
- if [ $? -ne 0 ]; then
- failwith "Nuget restore failed"
- fi
- fi
fi
# If building for CoreCLR, restore the Tools directory.
-if [ "$BUILD_PROTO_WITH_CORECLR_LKG" = '1' ]; then
+if [ "$BUILD_PROTO_WITH_CORECLR_LKG" = "1" ]; then
# Restore the Tools directory
./init-tools.sh
rc=$?;
@@ -497,10 +344,10 @@ _dotnetexe=dotnet
_architecture=win7-x64
# Build Proto
-if [ "$BUILD_PROTO" = '1' ]; then
+if [ "$BUILD_PROTO" = "1" ]; then
rm -rfd Proto
- if [ "$BUILD_PROTO_WITH_CORECLR_LKG" = '1' ]; then
+ if [ "$BUILD_PROTO_WITH_CORECLR_LKG" = "1" ]; then
{ pushd ./lkg/fsc && eval "$_dotnetexe restore" && popd; } || failwith "dotnet restore failed"
{ pushd ./lkg/fsi && eval "$_dotnetexe restore" && popd; } || failwith "dotnet restore failed"
@@ -512,58 +359,26 @@ if [ "$BUILD_PROTO" = '1' ]; then
# { printeval "$_ngenexe install Proto/net40/bin/fsc-proto.exe /nologo"; } || failwith "NGen of proto failed"
else
# Build proto-compiler and libs
- { printeval "$_msbuildexe $msbuildflags src/fsharp-proto-build.proj /p:UseMonoPackaging=true /p:Configuration=Proto /p:DisableLocalization=true"; } || failwith "compiler proto build failed"
+ { printeval "$_msbuildexe $msbuildflags src/fsharp-proto-build.proj /p:Configuration=Proto /p:DisableLocalization=true"; } || failwith "compiler proto build failed"
fi
fi
build_status "Done with proto, starting build"
-if [ "$BUILD_PHASE" = '1' ]; then
- cmd="$_msbuildexe $msbuildflags build-everything.proj /p:UseMonoPackaging=true /p:Configuration=$BUILD_CONFIG $BUILD_DIAG /p:BUILD_PUBLICSIGN=$BUILD_PUBLICSIGN"
+if [ "$BUILD_PHASE" = "1" ]; then
+ cmd="$_msbuildexe $msbuildflags build-everything.proj /p:Configuration=$BUILD_CONFIG $BUILD_DIAG /p:BUILD_PUBLICSIGN=$BUILD_PUBLICSIGN"
{ printeval "$cmd"; } || failwith "'$cmd' failed"
fi
-build_status "Main part of build finished, completing parts of build needed for Mono setup"
-
-if [ "$BUILD_NET40" = '1' ]; then
- { printeval "./autogen.sh --prefix=/usr"; } || failwith "./autogen.sh failed"
-
- { printeval "make"; } || failwith "make failed"
-fi
-
-build_status "Done with build, starting update/prepare"
-
-if [ "$BUILD_NET40" = '1' ]; then
-
- { printeval "sudo make install"; } || failwith "sudo make install failed"
-
-# WINDOWS:
-# src/update.sh $BUILD_CONFIG
-# rc=$?;
-# if [ $rc -ne 0 ]; then
-# printf "src/update script failed.\n"
-# exit $rc
-# fi
-fi
-
-NUNITPATH="packages/NUnit.Console.3.0.0/tools/"
-printf "set NUNITPATH=%s\n" "$NUNITPATH"
-if [ ! -d "$NUNITPATH" ]; then
- failwith "Could not find $NUNITPATH"
-fi
-
-{ printeval "cp -R $NUNITPATH ${_scriptdir}tests/fsharpqa/testenv/bin/nunit"; } || failwith "unable to copy nunit binaries to fsharpqa"
-{ printeval "cp -R ${_scriptdir}tests/fsharpqa/testenv/src/nunit ${_scriptdir}tests/fsharpqa/testenv/bin/nunit"; } || failwith "unable to copy nunit binaries to fsharpqa"
-
-# TODO: Define location of ildasm/monodis and sn
-
-if [ "$TEST_NET40_COMPILERUNIT_SUITE" = '0' ] && [ "$TEST_PORTABLE_COREUNIT_SUITE" = '0' ] && [ "$TEST_CORECLR_COREUNIT_SUITE" = '0' ] && [ "$TEST_VS_IDEUNIT_SUITE" = '0' ] && [ "$TEST_NET40_FSHARP_SUITE" = '0' ] && [ "$TEST_NET40_FSHARPQA_SUITE" = '0' ]; then
+if [ "$TEST_NET40_COMPILERUNIT_SUITE" != "1" ] && [ "$TEST_CORECLR_COREUNIT_SUITE" != "1" ] && [ "$TEST_NET40_FSHARP_SUITE" != "1" ]; then
# Successful build; not running tests so exit now.
exit 0
fi
-if [ $no_test -eq 1 ]; then
+NUNITPATH="packages/NUnit.Console.3.0.0/tools/"
+
+if [ "$no_test" = "1" ]; then
# Successful build; not running tests so exit now.
exit 0
fi
@@ -580,15 +395,7 @@ fi
printf "WHERE_ARG_NUNIT=%s\n" "$WHERE_ARG_NUNIT"
-export NUNITPATH="tests/fsharpqa/testenv/bin/nunit/"
export NUNIT3_CONSOLE="${NUNITPATH}nunit3-console.exe"
-export link_exe="${_scriptdir}packages/VisualCppTools.14.0.24519-Pre/lib/native/bin/link.exe"
-if [ ! -f "$link_exe" ]; then
- failwith "failed to find '$link_exe' use nuget to restore the VisualCppTools package"
-fi
-
-#if /I not '$single_threaded' == 'true' (set PARALLEL_ARG=-procs:$NUMBER_OF_PROCESSORS) else set PARALLEL_ARG=-procs:0
-
export FSCBINPATH="${_scriptdir}$BUILD_CONFIG/net40/bin"
export RESULTSDIR="${_scriptdir}tests/TestResults"
if [ ! -d "$RESULTSDIR" ]; then
@@ -597,19 +404,18 @@ fi
printf "FSCBINPATH=%s\n" "$FSCBINPATH"
printf "RESULTSDIR=%s\n" "$RESULTSDIR"
-printf "link_exe=%s\n" "$link_exe"
printf "NUNIT3_CONSOLE=%s\n" "$NUNIT3_CONSOLE"
printf "NUNITPATH=%s\n" "$NUNITPATH"
# ---------------- net40-fsharp -----------------------
-if [ "$TEST_NET40_FSHARP_SUITE" = '1' ]; then
+if [ "$TEST_NET40_FSHARP_SUITE" = "1" ]; then
OUTPUTARG=""
ERRORARG=""
OUTPUTFILE=""
ERRORFILE=""
XMLFILE="$RESULTSDIR/test-net40-fsharp-results.xml"
- if [ "$CI" = '1' ]; then
+ if [ "$CI" = "1" ]; then
OUTPUTFILE="$RESULTSDIR/test-net40-fsharp-output.log"
OUTPUTARG="--output:\"$OUTPUTFILE\""
ERRORFILE="$RESULTSDIR/test-net40-fsharp-errors.log"
@@ -630,14 +436,14 @@ fi
# ---------------- net40-compilerunit -----------------------
-if [ "$TEST_NET40_COMPILERUNIT_SUITE" = '1' ]; then
+if [ "$TEST_NET40_COMPILERUNIT_SUITE" = "1" ]; then
OUTPUTARG=""
ERRORARG=""
OUTPUTFILE=""
ERRORFILE="$RESULTSDIR/test-net40-compilerunit-errors.log"
XMLFILE="$RESULTSDIR/test-net40-compilerunit-results.xml"
- if [ "$CI" = '1' ]; then
+ if [ "$CI" = "1" ]; then
OUTPUTFILE="$RESULTSDIR/test-net40-compilerunit-output.log"
ERRORARG="--err:\"$ERRORFILE\""
OUTPUTARG="--output:\"$OUTPUTFILE\""
@@ -661,14 +467,14 @@ fi
# ---------------- net40-coreunit -----------------------
-if [ "$TEST_NET40_COREUNIT_SUITE" = '1' ]; then
+if [ "$TEST_NET40_COREUNIT_SUITE" = "1" ]; then
OUTPUTARG=""
ERRORARG=""
OUTPUTFILE=""
ERRORFILE=""
XMLFILE="$RESULTSDIR/test-net40-coreunit-results.xml"
- if [ "$CI" = '1' ]; then
+ if [ "$CI" = "1" ]; then
ERRORFILE="$RESULTSDIR/test-net40-coreunit-errors.log"
OUTPUTFILE="$RESULTSDIR/test-net40-coreunit-output.log"
ERRORARG="--err:\"$ERRORFILE\""
@@ -691,42 +497,10 @@ if [ "$TEST_NET40_COREUNIT_SUITE" = '1' ]; then
fi
fi
-# ---------------- portable-coreunit -----------------------
-
-if [ "$TEST_PORTABLE_COREUNIT_SUITE" = '1' ]; then
-
- OUTPUTARG=""
- ERRORARG=""
- OUTPUTFILE=""
- ERRORFILE=""
- XMLFILE="$RESULTSDIR/test-portable-coreunit-results.xml"
-
- if [ "$CI" = '1' ]; then
- OUTPUTFILE="$RESULTSDIR/test-portable-coreunit-output.log"
- ERRORFILE="$RESULTSDIR/test-portable-coreunit-errors.log"
- ERRORARG="--err:\"$ERRORFILE\""
- OUTPUTARG="--output:\"$OUTPUTFILE\""
- fi
-
- if ! printeval "mono $NUNIT3_CONSOLE /framework:V4.0 /result=\"$XMLFILE;format=nunit3\" $OUTPUTARG $ERRORARG /work=\"$FSCBINPATH\" \"$FSCBINPATH/../../portable7/bin/FSharp.Core.UnitTests.dll\" \"$FSCBINPATH/../../portable47/bin/FSharp.Core.UnitTests.dll\" \"$FSCBINPATH/../../portable78/bin/FSharp.Core.UnitTests.dll\" \"$FSCBINPATH/../../portable259/bin/FSharp.Core.UnitTests.dll\" $WHERE_ARG_NUNIT"; then
- if [ -f "$OUTPUTFILE" ]; then
- echo -----------------------------------------------------------------
- cat "$OUTPUTFILE"
- fi
- if [ -f "$ERRORFILE" ]; then
- echo -----------------------------------------------------------------
- cat "$ERRORFILE"
- fi
- echo -----------------------------------------------------------------
- echo Error: Running tests portable-coreunit failed, see logs above -- FAILED
- echo -----------------------------------------------------------------
- exit 1
- fi
-fi
# ---------------- coreclr-coreunit -----------------------
-if [ "$TEST_CORECLR_COREUNIT_SUITE" = '1' ]; then
+if [ "$TEST_CORECLR_COREUNIT_SUITE" = "1" ]; then
XMLFILE="$RESULTSDIR/test-coreclr-coreunit-results.xml"
OUTPUTFILE="$RESULTSDIR/test-coreclr-coreunit-output.log"
@@ -742,7 +516,7 @@ fi
# ---------------- coreclr-fsharp -----------------------
-if [ "$TEST_CORECLR_FSHARP_SUITE" = '1' ]; then
+if [ "$TEST_CORECLR_FSHARP_SUITE" = "1" ]; then
export single_threaded=true
export permutations=FSC_CORECLR
@@ -760,43 +534,3 @@ if [ "$TEST_CORECLR_FSHARP_SUITE" = '1' ]; then
fi
fi
-# ---------------- net40-fsharpqa -----------------------
-
-OSARCH="${PROCESSOR_ARCHITECTURE:-x64}"
-
-# Set this to 1 in order to use an external compiler host process
-# This only has an effect when running the FSHARPQA tests, but can
-# greatly speed up execution since fsc.exe does not need to be spawned thousands of times
-HOSTED_COMPILER=1
-
-if [ "$TEST_NET40_FSHARPQA_SUITE" = '1' ]; then
-
- export FSC="$FSCBINPATH/fsc.exe"
- export FSCOREDLLPATH="$FSCBINPATH/FSharp.Core.dll"
- export PATH="$FSCBINPATH;$PATH"
-
- if ! command -v perl > /dev/null; then
- failwith "perl is not in the PATH, it is required for the net40-fsharpqa test suite"
- fi
-
- OUTPUTFILE=test-net40-fsharpqa-results.log
- ERRORFILE=test-net40-fsharpqa-errors.log
- FAILENV=test-net40-fsharpqa-errors
-
- { pushd "${_scriptdir}tests/fsharpqa/source" && \
- printeval "perl tests/fsharpqa/testenv/bin/runall.pl -resultsroot $RESULTSDIR -results $OUTPUTFILE -log $ERRORFILE -fail $FAILENV -cleanup:no $TTAGS_ARG_RUNALL $PARALLEL_ARG" && \
- popd; } || {
- if [ -f "$RESULTSDIR/$OUTPUTFILE" ]; then
- echo -----------------------------------------------------------------
- cat "$RESULTSDIR/$OUTPUTFILE"
- fi
- if [ -f "$RESULTSDIR/$ERRORFILE" ]; then
- echo -----------------------------------------------------------------
- cat "$RESULTSDIR/$ERRORFILE"
- fi
- echo -----------------------------------------------------------------
- echo Error: Running tests net40-fsharpqa failed, see logs above -- FAILED
- echo -----------------------------------------------------------------
- exit 1
- }
-fi
diff --git a/build/targets/GitHash.props b/build/targets/GitHash.props
index 817240dbcab..e03e736e512 100644
--- a/build/targets/GitHash.props
+++ b/build/targets/GitHash.props
@@ -5,7 +5,7 @@
Copied from RepoToolset. Might be slightly modified to adjust for the current F# build system specifics if necessary.
-->
-
+$(FSharpSourcesRoot)\..\packages\FSharp.Compiler.Tools.4.1.27\tools
diff --git a/fcs/nuget/FSharp.Compiler.Service.MSBuild.v12.nuspec b/fcs/nuget/FSharp.Compiler.Service.MSBuild.v12.nuspec
index ae9c17a7819..6c20765492a 100644
--- a/fcs/nuget/FSharp.Compiler.Service.MSBuild.v12.nuspec
+++ b/fcs/nuget/FSharp.Compiler.Service.MSBuild.v12.nuspec
@@ -5,7 +5,7 @@
Adds legacy MSBuild 12.0 support to the F# compiler services package for resolving references such as #r "System, Version=4.1.0.0,..."en-USfalse
- 16.0.3
+ 19.0.1Microsoft Corporation and F# community contributorshttps://github.com/fsharp/FSharp.Compiler.Service/blob/master/LICENSEhttps://github.com/fsharp/FSharp.Compiler.Service
@@ -14,7 +14,7 @@
F# compiler services for creating IDE tools, language extensions and for F# embedding.
-
+
diff --git a/fcs/nuget/FSharp.Compiler.Service.ProjectCracker.nuspec b/fcs/nuget/FSharp.Compiler.Service.ProjectCracker.nuspec
index e45bb835728..9b2f6ea823a 100644
--- a/fcs/nuget/FSharp.Compiler.Service.ProjectCracker.nuspec
+++ b/fcs/nuget/FSharp.Compiler.Service.ProjectCracker.nuspec
@@ -5,7 +5,7 @@
The F# compiler services package contains a custom build of the F# compiler that exposes additional functionality for implementing F# language bindings, additional tools based on the compiler or refactoring tools. The package also includes F# interactive service that can be used for embedding F# scripting into your applications.en-USfalse
- 16.0.3
+ 19.0.1Microsoft Corporation and F# community contributorshttps://github.com/fsharp/FSharp.Compiler.Service/blob/master/LICENSEhttps://github.com/fsharp/FSharp.Compiler.Service
@@ -14,7 +14,7 @@
F# compiler services for creating IDE tools, language extensions and for F# embedding.
-
+
diff --git a/fcs/nuget/FSharp.Compiler.Service.nuspec b/fcs/nuget/FSharp.Compiler.Service.nuspec
index ba4c2e7c3d5..37229cf4a39 100644
--- a/fcs/nuget/FSharp.Compiler.Service.nuspec
+++ b/fcs/nuget/FSharp.Compiler.Service.nuspec
@@ -5,7 +5,7 @@
The F# compiler services package contains a custom build of the F# compiler that exposes additional functionality for implementing F# language bindings, additional tools based on the compiler or refactoring tools. The package also includes F# interactive service that can be used for embedding F# scripting into your applications.en-USfalse
- 16.0.3
+ 19.0.1Microsoft Corporation and F# community contributorshttps://github.com/fsharp/FSharp.Compiler.Service/blob/master/LICENSEhttps://github.com/fsharp/FSharp.Compiler.Service
diff --git a/mono/appveyor.ps1 b/mono/appveyor.ps1
index b26a52d32f9..30445b98db0 100644
--- a/mono/appveyor.ps1
+++ b/mono/appveyor.ps1
@@ -1,6 +1,6 @@
# the version under development, update after a release
-$version = '4.1.28'
+$version = '4.1.31'
function isVersionTag($tag){
$v = New-Object Version
diff --git a/netci.groovy b/netci.groovy
index cc7956a9834..c5da454d852 100644
--- a/netci.groovy
+++ b/netci.groovy
@@ -14,12 +14,14 @@ def static getBuildJobName(def configuration, def os) {
osList.each { os ->
def configurations = [];
if (os == 'Windows_NT') {
- configurations = ['Debug', 'Release_ci_part1', 'Release_ci_part2', 'Release_ci_part3', 'Release_net40_no_vs', 'Release_fcs' ];
+ configurations = ['Debug_default', 'Release_ci_part1', 'Release_ci_part2', 'Release_ci_part3', 'Release_net40_no_vs', 'Release_fcs' ];
}
else
{
// Linux
- configurations = ['Release', 'Release_fcs' ];
+ // TODO: It should be possible to enable these configurations immediately subsequent to the PR containing this line
+ //configurations = ['Debug_default', 'Release_net40_test', 'Release_fcs' ];
+ configurations = [ 'Release_default', 'Release_fcs' ];
}
configurations.each { configuration ->
@@ -50,27 +52,37 @@ def static getBuildJobName(def configuration, def os) {
build_args = "Build"
}
}
- else if (configuration == "Debug") {
+ else if (configuration == "Debug_default") {
buildFlavor = "debug"
build_args = ""
}
+ else if (configuration == "Release_default") {
+ buildFlavor = "release"
+ build_args = ""
+ }
+ else if (configuration == "Release_net40_test") {
+ buildFlavor = "release"
+ build_args = "net40 test"
+ }
+ else if (configuration == "Release_ci_part1") {
+ buildFlavor = "release"
+ build_args = "ci_part1"
+ }
+ else if (configuration == "Release_ci_part2") {
+ buildFlavor = "release"
+ build_args = "ci_part2"
+ }
+ else if (configuration == "Release_ci_part3") {
+ buildFlavor = "release"
+ build_args = "ci_part3"
+ }
+ else if (configuration == "Release_net40_no_vs") {
+ buildFlavor = "release"
+ build_args = "net40"
+ }
else {
buildFlavor = "release"
- if (configuration == "Release_ci_part1") {
- build_args = "ci_part1"
- }
- else if (configuration == "Release_ci_part2") {
- build_args = "ci_part2"
- }
- else if (configuration == "Release_ci_part3") {
- build_args = "ci_part3"
- }
- else if (configuration == "Release_net40_no_vs") {
- build_args = "net40"
- }
- else {
- build_args = "none"
- }
+ build_args = "none"
}
if (os == 'Windows_NT') {
@@ -99,7 +111,7 @@ ${buildPath}build.cmd ${buildFlavor} ${build_args}""")
// TODO: set to false after tests are fully enabled
def skipIfNoTestFiles = true
- def affinity = configuration == 'Release_net40_no_vs' ? 'latest-or-auto' : (os == 'Windows_NT' ? 'latest-or-auto-dev15-0' : 'latest-or-auto')
+ def affinity = configuration == 'Release_net40_no_vs' ? 'latest-or-auto' : (os == 'Windows_NT' ? 'latest-dev15-5' : 'latest-or-auto')
Utilities.setMachineAffinity(newJob, os, affinity)
Utilities.standardJobSetup(newJob, project, isPullRequest, "*/${branch}")
diff --git a/packages.config b/packages.config
index 8ef434167ea..48b6de3726b 100644
--- a/packages.config
+++ b/packages.config
@@ -21,6 +21,10 @@
+
+
+
+
diff --git a/scripts/dotnet-install.sh b/scripts/dotnet-install.sh
old mode 100644
new mode 100755
diff --git a/src/FSharpSource.Profiles.targets b/src/FSharpSource.Profiles.targets
index d56c1d703fd..8bcc8aa5f24 100644
--- a/src/FSharpSource.Profiles.targets
+++ b/src/FSharpSource.Profiles.targets
@@ -3,7 +3,7 @@
- $(DefineConstants);PREFERRED_UI_LANG
+ $(DefineConstants);CROSS_PLATFORM_COMPILER$(DefineConstants);ENABLE_MONO_SUPPORT$(DefineConstants);BE_SECURITY_TRANSPARENT$(DefineConstants);FX_LCIDFROMCODEPAGE
@@ -15,7 +15,6 @@
$(DefineConstants);FX_PORTABLE_OR_NETSTANDARD$(DefineConstants);NETSTANDARD1_6
- $(DefineConstants);PREFERRED_UI_LANG$(DefineConstants);FX_NO_APP_DOMAINS$(DefineConstants);FX_NO_ARRAY_LONG_LENGTH$(DefineConstants);FX_NO_BEGINEND_READWRITE
diff --git a/src/FSharpSource.Settings.targets b/src/FSharpSource.Settings.targets
index 35086a642f7..ee3810db644 100644
--- a/src/FSharpSource.Settings.targets
+++ b/src/FSharpSource.Settings.targets
@@ -98,19 +98,27 @@
$(FSharpSourcesRoot)\..\packages\NUnit.$(NUnitVersion)\lib\net45$(FSharpSourcesRoot)\..\packages\NUnit.ConsoleRunner\$(NUnitVersion)\tools\
+ true
+
+ truetrue0.2.0-beta-000076
+
+
+ false
+ truetrue$(FSharpSourcesRoot)\fsharp\msft.pubkeytruetrue
-
+
+ truefalsetrue
@@ -130,6 +138,7 @@
full
+ portablefalseprompt
@@ -142,6 +151,7 @@
pdbonly
+ portabletruefalse
@@ -153,6 +163,7 @@
full
+ portabletrueDEBUG;NO_STRONG_NAMES;$(DefineConstants)
@@ -196,6 +207,11 @@
$(FSharpSourcesRoot)\..\packages\FSharp.Compiler.Tools.4.1.27\tools
+
+
+
+ 14.0.0.0
+
diff --git a/src/FSharpSource.targets b/src/FSharpSource.targets
index c3f6de55051..206259ae082 100644
--- a/src/FSharpSource.targets
+++ b/src/FSharpSource.targets
@@ -8,74 +8,43 @@
-
-
-
- false
- true
-
-
-
-
-
-
-
-
- true
- false
- fs
-
-
-
-
-
-
- true
- true
- fs
-
-
-
-
-
-
-
- true
- $(FSharpSourcesRoot)\fsharp\msft.pubkey
- true
- true
- fs
-
-
-
-
-
-
-
- NO_STRONG_NAMES;$(DefineConstants)
- fs
-
-
-
+
+ fs
+
-
- $(OtherFlags) --version:"$(MicroBuildAssemblyVersion)"
+
+
+
+ true
+ false
+ false
+ NO_STRONG_NAMES;$(DefineConstants)
-
- $(IntermediateOutputPath)source_link.json
+
+
+ $(FSharpSourcesRoot)\fsharp\test.snk
+ false
+ STRONG_NAME_FSHARP_COMPILER_WITH_TEST_KEY;$(DefineConstants)
-
- NO_STRONG_NAMES;$(DefineConstants)
+
+
+ $(FSCoreVersion)
+ $(OtherFlags) --version:"$(MicroBuildAssemblyVersion)"
+
+
+
+ $(IntermediateOutputPath)source_link.json
+
MSBUILD_AT_LEAST_14;$(DefineConstants)
+
-
false
@@ -126,7 +95,8 @@
fsharp30\$(TargetDotnetProfile)fsharp31\$(TargetDotnetProfile)fsharp40\$(TargetDotnetProfile)
- obj\$(TargetFrameworkOutputDirectory)\
+ $(TargetDotnetProfile)
+ obj\$(Configuration)\$(TargetFrameworkOutputDirectory)\
@@ -380,9 +350,14 @@
-
+
+
<_PublicKey>002400000480000094000000060200000024000052534131000400000100010007D1FA57C4AED9F0A32E84AA0FAEFD0DE9E8FD6AEC8F87FB03766C834C99921EB23BE79AD9D5DCC1DD9AD236132102900B723CF980957FC4E177108FC607774F29E8320E92EA05ECE4E821C0A5EFE8F1645C4C0C93C1AB99285D622CAA652C1DFAD63D745D6F2DE5F17E5EAF0FC4963D261C8A12436518206DC093344D5AD293
+
+
+ <_PublicKey>002400000480000094000000060200000024000052534131000400000100010077d32e043d184cf8cebf177201ec6fad091581a3a639a0534f1c4ebb3ab847a6b6636990224a04cf4bd1aec51ecec44cf0c8922eb5bb2ee65ec3fb9baa87e141042c96ce414f98af33508c7e24dab5b068aa802f6693881537ee0efcb5d3f1c9aaf8215ac42e92ba9a5a02574d6890d07464cb2f338b043b1c4ffe98efe069ee
+
<_InternalsVisibleToAttribute Include="System.Runtime.CompilerServices.InternalsVisibleToAttribute">
<_Parameter1 Condition="'%(InternalsVisibleTo.Key)' != ''">%(InternalsVisibleTo.Identity), PublicKey=%(InternalsVisibleTo.Key)
diff --git a/src/absil/il.fs b/src/absil/il.fs
index 6f5f0d873b3..9335440f70c 100644
--- a/src/absil/il.fs
+++ b/src/absil/il.fs
@@ -726,7 +726,7 @@ type ILMethodRef =
mrefName: string;
mrefArgs: ILTypes;
mrefReturn: ILType }
- member x.EnclosingTypeRef = x.mrefParent
+ member x.DeclaringTypeRef = x.mrefParent
member x.CallingConv = x.mrefCallconv
member x.Name = x.mrefName
member x.GenericArity = x.mrefGenericArity
@@ -737,24 +737,24 @@ type ILMethodRef =
member x.CallingSignature = mkILCallSig (x.CallingConv,x.ArgTypes,x.ReturnType)
static member Create(a,b,c,d,e,f) =
{ mrefParent= a;mrefCallconv=b;mrefName=c;mrefGenericArity=d; mrefArgs=e;mrefReturn=f }
- override x.ToString() = x.EnclosingTypeRef.ToString() + "::" + x.Name + "(...)"
+ override x.ToString() = x.DeclaringTypeRef.ToString() + "::" + x.Name + "(...)"
[]
type ILFieldRef =
- { EnclosingTypeRef: ILTypeRef;
+ { DeclaringTypeRef: ILTypeRef;
Name: string;
Type: ILType }
- override x.ToString() = x.EnclosingTypeRef.ToString() + "::" + x.Name
+ override x.ToString() = x.DeclaringTypeRef.ToString() + "::" + x.Name
[]
type ILMethodSpec =
{ mspecMethodRef: ILMethodRef;
- mspecEnclosingType: ILType;
+ mspecDeclaringType: ILType;
mspecMethodInst: ILGenericArgs; }
- static member Create(a,b,c) = { mspecEnclosingType=a; mspecMethodRef =b; mspecMethodInst=c }
+ static member Create(a,b,c) = { mspecDeclaringType=a; mspecMethodRef =b; mspecMethodInst=c }
member x.MethodRef = x.mspecMethodRef
- member x.EnclosingType=x.mspecEnclosingType
+ member x.DeclaringType=x.mspecDeclaringType
member x.GenericArgs=x.mspecMethodInst
member x.Name=x.MethodRef.Name
member x.CallingConv=x.MethodRef.CallingConv
@@ -766,10 +766,10 @@ type ILMethodSpec =
type ILFieldSpec =
{ FieldRef: ILFieldRef;
- EnclosingType: ILType }
+ DeclaringType: ILType }
member x.FormalType = x.FieldRef.Type
member x.Name = x.FieldRef.Name
- member x.EnclosingTypeRef = x.FieldRef.EnclosingTypeRef
+ member x.DeclaringTypeRef = x.FieldRef.DeclaringTypeRef
override x.ToString() = x.FieldRef.ToString()
@@ -1302,7 +1302,7 @@ type ILReturn =
type ILOverridesSpec =
| OverridesSpec of ILMethodRef * ILType
member x.MethodRef = let (OverridesSpec(mr,_ty)) = x in mr
- member x.EnclosingType = let (OverridesSpec(_mr,ty)) = x in ty
+ member x.DeclaringType = let (OverridesSpec(_mr,ty)) = x in ty
type ILMethodVirtualInfo =
{ IsFinal: bool
@@ -1817,10 +1817,10 @@ let mkILMethRef (tref,callconv,nm,gparams,args,rty) =
let mkILMethSpecForMethRefInTy (mref,typ,minst) =
{ mspecMethodRef=mref;
- mspecEnclosingType=typ;
+ mspecDeclaringType=typ;
mspecMethodInst=minst }
-let mkILMethSpec (mref, vc, tinst, minst) = mkILMethSpecForMethRefInTy (mref,mkILNamedTy vc mref.EnclosingTypeRef tinst, minst)
+let mkILMethSpec (mref, vc, tinst, minst) = mkILMethSpecForMethRefInTy (mref,mkILNamedTy vc mref.DeclaringTypeRef tinst, minst)
let mk_mspec_in_tref (tref,vc,cc,nm,args,rty,tinst,minst) =
mkILMethSpec (mkILMethRef ( tref,cc,nm,List.length minst,args,rty),vc,tinst,minst)
@@ -1856,9 +1856,9 @@ let mkILNonGenericCtorMethSpec (tref,args) =
// Make references to fields
// --------------------------------------------------------------------
-let mkILFieldRef(tref,nm,ty) = { EnclosingTypeRef=tref; Name=nm; Type=ty}
+let mkILFieldRef(tref,nm,ty) = { DeclaringTypeRef=tref; Name=nm; Type=ty}
-let mkILFieldSpec (tref,ty) = { FieldRef= tref; EnclosingType=ty }
+let mkILFieldSpec (tref,ty) = { FieldRef= tref; DeclaringType=ty }
let mkILFieldSpecInTy (typ:ILType,nm,fty) =
mkILFieldSpec (mkILFieldRef (typ.TypeRef,nm,fty), typ)
@@ -2205,7 +2205,7 @@ and rescopeILCallSig scoref csig =
mkILCallSig (csig.CallingConv,rescopeILTypes scoref csig.ArgTypes,rescopeILType scoref csig.ReturnType)
let rescopeILMethodRef scoref (x:ILMethodRef) =
- { mrefParent = rescopeILTypeRef scoref x.EnclosingTypeRef;
+ { mrefParent = rescopeILTypeRef scoref x.DeclaringTypeRef;
mrefCallconv = x.mrefCallconv;
mrefGenericArity=x.mrefGenericArity;
mrefName=x.mrefName;
@@ -2213,7 +2213,7 @@ let rescopeILMethodRef scoref (x:ILMethodRef) =
mrefReturn= rescopeILType scoref x.mrefReturn }
let rescopeILFieldRef scoref x =
- { EnclosingTypeRef = rescopeILTypeRef scoref x.EnclosingTypeRef;
+ { DeclaringTypeRef = rescopeILTypeRef scoref x.DeclaringTypeRef;
Name= x.Name;
Type= rescopeILType scoref x.Type }
@@ -2277,7 +2277,7 @@ let mkILLocal ty dbgInfo : ILLocal =
type ILFieldSpec with
member fr.ActualType =
- let env = fr.EnclosingType.GenericArgs
+ let env = fr.DeclaringType.GenericArgs
instILType env fr.FormalType
// --------------------------------------------------------------------
@@ -3482,20 +3482,20 @@ and refs_of_genparams s b = List.iter (refs_of_genparam s) b
and refs_of_dloc s ts = refs_of_tref s ts
and refs_of_mref s (x:ILMethodRef) =
- refs_of_dloc s x.EnclosingTypeRef ;
+ refs_of_dloc s x.DeclaringTypeRef ;
refs_of_typs s x.mrefArgs;
refs_of_typ s x.mrefReturn
-and refs_of_fref s x = refs_of_tref s x.EnclosingTypeRef; refs_of_typ s x.Type
+and refs_of_fref s x = refs_of_tref s x.DeclaringTypeRef; refs_of_typ s x.Type
and refs_of_ospec s (OverridesSpec(mref,ty)) = refs_of_mref s mref; refs_of_typ s ty
and refs_of_mspec s (x: ILMethodSpec) =
refs_of_mref s x.MethodRef;
- refs_of_typ s x.EnclosingType;
+ refs_of_typ s x.DeclaringType;
refs_of_inst s x.GenericArgs
and refs_of_fspec s x =
refs_of_fref s x.FieldRef;
- refs_of_typ s x.EnclosingType
+ refs_of_typ s x.DeclaringType
and refs_of_typs s l = List.iter (refs_of_typ s) l
@@ -3769,11 +3769,11 @@ let ungenericizeTypeName n =
type ILEventRef =
{ erA: ILTypeRef; erB: string }
static member Create(a,b) = {erA=a;erB=b}
- member x.EnclosingTypeRef = x.erA
+ member x.DeclaringTypeRef = x.erA
member x.Name = x.erB
type ILPropertyRef =
{ prA: ILTypeRef; prB: string }
static member Create (a,b) = {prA=a;prB=b}
- member x.EnclosingTypeRef = x.prA
+ member x.DeclaringTypeRef = x.prA
member x.Name = x.prB
diff --git a/src/absil/il.fsi b/src/absil/il.fsi
index 4d3cfd74d4a..b6f374217f2 100644
--- a/src/absil/il.fsi
+++ b/src/absil/il.fsi
@@ -372,7 +372,7 @@ and ILTypes = list
[]
type ILMethodRef =
static member Create : enclosingTypeRef: ILTypeRef * callingConv: ILCallingConv * name: string * genericArity: int * argTypes: ILTypes * returnType: ILType -> ILMethodRef
- member EnclosingTypeRef: ILTypeRef
+ member DeclaringTypeRef: ILTypeRef
member CallingConv: ILCallingConv
member Name: string
member GenericArity: int
@@ -386,7 +386,7 @@ type ILMethodRef =
[]
type ILFieldRef =
- { EnclosingTypeRef: ILTypeRef;
+ { DeclaringTypeRef: ILTypeRef;
Name: string;
Type: ILType }
@@ -407,7 +407,7 @@ type ILFieldRef =
type ILMethodSpec =
static member Create : ILType * ILMethodRef * ILGenericArgs -> ILMethodSpec
member MethodRef: ILMethodRef
- member EnclosingType: ILType
+ member DeclaringType: ILType
member GenericArgs: ILGenericArgs
member CallingConv: ILCallingConv
member GenericArity: int
@@ -421,8 +421,8 @@ type ILMethodSpec =
[]
type ILFieldSpec =
{ FieldRef: ILFieldRef;
- EnclosingType: ILType }
- member EnclosingTypeRef: ILTypeRef
+ DeclaringType: ILType }
+ member DeclaringTypeRef: ILTypeRef
member Name: string
member FormalType: ILType
member ActualType : ILType
@@ -963,7 +963,7 @@ type PInvokeMethod =
type ILOverridesSpec =
| OverridesSpec of ILMethodRef * ILType
member MethodRef: ILMethodRef
- member EnclosingType: ILType
+ member DeclaringType: ILType
// REVIEW: fold this into ILMethodDef.
type ILMethodVirtualInfo =
@@ -1921,13 +1921,13 @@ val computeILEnumInfo: string * ILFieldDefs -> ILEnumInfo
[]
type ILEventRef =
static member Create : ILTypeRef * string -> ILEventRef
- member EnclosingTypeRef: ILTypeRef
+ member DeclaringTypeRef: ILTypeRef
member Name: string
[]
type ILPropertyRef =
static member Create : ILTypeRef * string -> ILPropertyRef
- member EnclosingTypeRef: ILTypeRef
+ member DeclaringTypeRef: ILTypeRef
member Name: string
interface System.IComparable
diff --git a/src/absil/ilmorph.fs b/src/absil/ilmorph.fs
index dc0d27e1feb..90b0e267f69 100644
--- a/src/absil/ilmorph.fs
+++ b/src/absil/ilmorph.fs
@@ -103,7 +103,7 @@ let gparam_typ2typ f gf = {gf with Constraints = List.map f gf.Constraints}
let gparams_typ2typ f gfs = List.map (gparam_typ2typ f) gfs
let typs_typ2typ (f: ILType -> ILType) x = List.map f x
let mref_typ2typ (f: ILType -> ILType) (x:ILMethodRef) =
- ILMethodRef.Create(enclosingTypeRef= (f (mkILBoxedType (mkILNonGenericTySpec x.EnclosingTypeRef))).TypeRef,
+ ILMethodRef.Create(enclosingTypeRef= (f (mkILBoxedType (mkILNonGenericTySpec x.DeclaringTypeRef))).TypeRef,
callingConv=x.CallingConv,
name=x.Name,
genericArity=x.GenericArity,
@@ -115,16 +115,16 @@ type formal_scopeCtxt = Choice
let mspec_typ2typ (((factualty : ILType -> ILType) , (fformalty: formal_scopeCtxt -> ILType -> ILType))) (x: ILMethodSpec) =
mkILMethSpecForMethRefInTy(mref_typ2typ (fformalty (Choice1Of2 x)) x.MethodRef,
- factualty x.EnclosingType,
+ factualty x.DeclaringType,
typs_typ2typ factualty x.GenericArgs)
let fref_typ2typ (f: ILType -> ILType) x =
- { x with EnclosingTypeRef = (f (mkILBoxedType (mkILNonGenericTySpec x.EnclosingTypeRef))).TypeRef;
+ { x with DeclaringTypeRef = (f (mkILBoxedType (mkILNonGenericTySpec x.DeclaringTypeRef))).TypeRef;
Type= f x.Type }
let fspec_typ2typ ((factualty,(fformalty : formal_scopeCtxt -> ILType -> ILType))) x =
{ FieldRef=fref_typ2typ (fformalty (Choice2Of2 x)) x.FieldRef;
- EnclosingType= factualty x.EnclosingType }
+ DeclaringType= factualty x.DeclaringType }
let rec celem_typ2typ f celem =
match celem with
diff --git a/src/absil/ilprint.fs b/src/absil/ilprint.fs
index 6c98fc605b9..0e1727effe1 100644
--- a/src/absil/ilprint.fs
+++ b/src/absil/ilprint.fs
@@ -338,12 +338,12 @@ and goutput_mref env os (mref:ILMethodRef) =
and goutput_mspec env os (mspec:ILMethodSpec) =
let fenv =
ppenv_enter_method mspec.GenericArity
- (ppenv_enter_tdef (mkILFormalTypars mspec.EnclosingType.GenericArgs) env)
+ (ppenv_enter_tdef (mkILFormalTypars mspec.DeclaringType.GenericArgs) env)
output_callconv os mspec.CallingConv;
output_string os " ";
goutput_typ fenv os mspec.FormalReturnType;
output_string os " ";
- goutput_dlocref env os mspec.EnclosingType;
+ goutput_dlocref env os mspec.DeclaringType;
output_string os " ";
let name = mspec.Name
if name = ".ctor" || name = ".cctor" then output_string os name else output_id os name;
@@ -356,12 +356,12 @@ and goutput_vararg_mspec env os (mspec, varargs) =
| Some varargs' ->
let fenv =
ppenv_enter_method mspec.GenericArity
- (ppenv_enter_tdef (mkILFormalTypars mspec.EnclosingType.GenericArgs) env)
+ (ppenv_enter_tdef (mkILFormalTypars mspec.DeclaringType.GenericArgs) env)
output_callconv os mspec.CallingConv;
output_string os " ";
goutput_typ fenv os mspec.FormalReturnType;
output_string os " ";
- goutput_dlocref env os mspec.EnclosingType;
+ goutput_dlocref env os mspec.DeclaringType;
let name = mspec.Name
if name = ".ctor" || name = ".cctor" then output_string os name else output_id os name
goutput_gactuals env os mspec.GenericArgs;
@@ -385,10 +385,10 @@ and goutput_vararg_sig env os (csig:ILCallingSignature,varargs:ILVarArgs) =
output_string os ")";
and goutput_fspec env os (x:ILFieldSpec) =
- let fenv = ppenv_enter_tdef (mkILFormalTypars x.EnclosingType.GenericArgs) env
+ let fenv = ppenv_enter_tdef (mkILFormalTypars x.DeclaringType.GenericArgs) env
goutput_typ fenv os x.FormalType;
output_string os " ";
- goutput_dlocref env os x.EnclosingType;
+ goutput_dlocref env os x.DeclaringType;
output_id os x.Name
let output_member_access os access =
diff --git a/src/absil/ilread.fs b/src/absil/ilread.fs
index f4ea49effee..b4a88f58e7d 100644
--- a/src/absil/ilread.fs
+++ b/src/absil/ilread.fs
@@ -1877,7 +1877,7 @@ and seekReadMethodRefParent ctxt numtypars (TaggedIndex(tag, idx)) =
| tag when tag = mrp_MethodDef ->
let (MethodData(enclTyp, cc, nm, argtys, retty, minst)) = seekReadMethodDefAsMethodData ctxt idx
let mspec = mkILMethSpecInTy (enclTyp, cc, nm, argtys, retty, minst)
- mspec.EnclosingType
+ mspec.DeclaringType
| tag when tag = mrp_TypeSpec -> readBlobHeapAsType ctxt numtypars (seekReadTypeSpecRow ctxt idx)
| _ -> failwith "seekReadMethodRefParent ctxt"
@@ -2416,7 +2416,7 @@ and seekReadMethodImpls ctxt numtypars tidx =
Overrides=
let (MethodData(enclTyp, cc, nm, argtys, retty, minst)) = seekReadMethodDefOrRefNoVarargs ctxt numtypars c
let mspec = mkILMethSpecInTy (enclTyp, cc, nm, argtys, retty, minst)
- OverridesSpec(mspec.MethodRef, mspec.EnclosingType) }))
+ OverridesSpec(mspec.MethodRef, mspec.DeclaringType) }))
and seekReadMultipleMethodSemantics ctxt (flags, id) =
seekReadIndexedRows
diff --git a/src/absil/ilreflect.fs b/src/absil/ilreflect.fs
index f35e6e7b792..774b7a24366 100644
--- a/src/absil/ilreflect.fs
+++ b/src/absil/ilreflect.fs
@@ -654,7 +654,7 @@ let typeIsNotQueryable (typ : Type) =
let queryableTypeGetField _emEnv (parentT:Type) (fref: ILFieldRef) =
let res = parentT.GetField(fref.Name, BindingFlags.Public ||| BindingFlags.NonPublic ||| BindingFlags.Instance ||| BindingFlags.Static )
match res with
- | null -> error(Error(FSComp.SR.itemNotFoundInTypeDuringDynamicCodeGen ("field", fref.Name, fref.EnclosingTypeRef.FullName, fref.EnclosingTypeRef.Scope.QualifiedName), range0))
+ | null -> error(Error(FSComp.SR.itemNotFoundInTypeDuringDynamicCodeGen ("field", fref.Name, fref.DeclaringTypeRef.FullName, fref.DeclaringTypeRef.Scope.QualifiedName), range0))
| _ -> res
let nonQueryableTypeGetField (parentTI:Type) (fieldInfo : FieldInfo) : FieldInfo =
@@ -668,8 +668,8 @@ let nonQueryableTypeGetField (parentTI:Type) (fieldInfo : FieldInfo) : FieldInfo
let convFieldSpec cenv emEnv fspec =
let fref = fspec.FieldRef
- let tref = fref.EnclosingTypeRef
- let parentTI = convType cenv emEnv fspec.EnclosingType
+ let tref = fref.DeclaringTypeRef
+ let parentTI = convType cenv emEnv fspec.DeclaringType
if isEmittedTypeRef emEnv tref then
// NOTE: if "convType becomes convCreatedType", then handle queryable types here too. [bug 4063] (necessary? what repro?)
let fieldB = envGetFieldB emEnv fref
@@ -793,7 +793,7 @@ let nonQueryableTypeGetMethod (parentTI:Type) (methInfo : MethodInfo) : MethodIn
else methInfo
let convMethodRef cenv emEnv (parentTI:Type) (mref:ILMethodRef) =
- let parent = mref.EnclosingTypeRef
+ let parent = mref.DeclaringTypeRef
let res =
if isEmittedTypeRef emEnv parent then
// NOTE: if "convType becomes convCreatedType", then handle queryable types here too. [bug 4063]
@@ -817,7 +817,7 @@ let convMethodRef cenv emEnv (parentTI:Type) (mref:ILMethodRef) =
//----------------------------------------------------------------------------
let convMethodSpec cenv emEnv (mspec:ILMethodSpec) =
- let typT = convType cenv emEnv mspec.EnclosingType (* (instanced) parent Type *)
+ let typT = convType cenv emEnv mspec.DeclaringType (* (instanced) parent Type *)
let methInfo = convMethodRef cenv emEnv typT mspec.MethodRef (* (generic) method of (generic) parent *)
let methInfo =
if isNil mspec.GenericArgs then
@@ -852,9 +852,9 @@ let nonQueryableTypeGetConstructor (parentTI:Type) (consInfo : ConstructorInfo)
let convConstructorSpec cenv emEnv (mspec:ILMethodSpec) =
let mref = mspec.MethodRef
- let parentTI = convType cenv emEnv mspec.EnclosingType
+ let parentTI = convType cenv emEnv mspec.DeclaringType
let res =
- if isEmittedTypeRef emEnv mref.EnclosingTypeRef then
+ if isEmittedTypeRef emEnv mref.DeclaringTypeRef then
let consB = envGetConsB emEnv mref
nonQueryableTypeGetConstructor parentTI consB
else
diff --git a/src/absil/ilwrite.fs b/src/absil/ilwrite.fs
index 81fcf5be8ae..8ea9dec6a7a 100644
--- a/src/absil/ilwrite.fs
+++ b/src/absil/ilwrite.fs
@@ -406,8 +406,8 @@ type ILTypeWriterEnv = { EnclosingTyparCount: int }
let envForTypeDef (td:ILTypeDef) = { EnclosingTyparCount=td.GenericParams.Length }
let envForMethodRef env (typ:ILType) = { EnclosingTyparCount=(match typ with ILType.Array _ -> env.EnclosingTyparCount | _ -> typ.GenericArgs.Length) }
let envForNonGenericMethodRef _mref = { EnclosingTyparCount=System.Int32.MaxValue }
-let envForFieldSpec (fspec:ILFieldSpec) = { EnclosingTyparCount=fspec.EnclosingType.GenericArgs.Length }
-let envForOverrideSpec (ospec:ILOverridesSpec) = { EnclosingTyparCount=ospec.EnclosingType.GenericArgs.Length }
+let envForFieldSpec (fspec:ILFieldSpec) = { EnclosingTyparCount=fspec.DeclaringType.GenericArgs.Length }
+let envForOverrideSpec (ospec:ILOverridesSpec) = { EnclosingTyparCount=ospec.DeclaringType.GenericArgs.Length }
//---------------------------------------------------------------------
// TABLES
@@ -1285,7 +1285,7 @@ and GetFieldDefAsFieldDefIdx cenv tidx fd =
// --------------------------------------------------------------------
let GetMethodRefAsMethodDefIdx cenv (mref:ILMethodRef) =
- let tref = mref.EnclosingTypeRef
+ let tref = mref.DeclaringTypeRef
try
if not (isTypeRefLocal tref) then
failwithf "method referred to by method impl, event or property is not in a type defined in this module, method ref is %A" mref
@@ -1358,7 +1358,7 @@ and GetMethodSpecAsMethodDef cenv env (mspec, varargs) =
and InfoOfMethodSpec (mspec:ILMethodSpec, varargs) =
(mspec.Name,
- mspec.EnclosingType,
+ mspec.DeclaringType,
mspec.CallingConv,
mspec.FormalArgTypes,
mspec.FormalReturnType,
@@ -1373,11 +1373,11 @@ and InfoOfMethodSpec (mspec:ILMethodSpec, varargs) =
let rec GetOverridesSpecAsMemberRefIdx cenv env ospec =
let fenv = envForOverrideSpec ospec
- let row = MethodRefInfoAsMemberRefRow cenv env fenv (ospec.MethodRef.Name, ospec.EnclosingType, ospec.MethodRef.CallingConv, ospec.MethodRef.ArgTypes, ospec.MethodRef.ReturnType, None, ospec.MethodRef.GenericArity)
+ let row = MethodRefInfoAsMemberRefRow cenv env fenv (ospec.MethodRef.Name, ospec.DeclaringType, ospec.MethodRef.CallingConv, ospec.MethodRef.ArgTypes, ospec.MethodRef.ReturnType, None, ospec.MethodRef.GenericArity)
FindOrAddSharedRow cenv TableNames.MemberRef row
and GetOverridesSpecAsMethodDefOrRef cenv env (ospec:ILOverridesSpec) =
- let typ = ospec.EnclosingType
+ let typ = ospec.DeclaringType
if isTypeLocal typ then
if not typ.IsNominal then failwith "GetOverridesSpecAsMethodDefOrRef: unexpected local tref-typ"
try (mdor_MethodDef, GetMethodRefAsMethodDefIdx cenv ospec.MethodRef)
@@ -1392,12 +1392,12 @@ and GetOverridesSpecAsMethodDefOrRef cenv env (ospec:ILOverridesSpec) =
// --------------------------------------------------------------------
let rec GetMethodRefAsMemberRefIdx cenv env fenv (mref:ILMethodRef) =
- let row = MethodRefInfoAsMemberRefRow cenv env fenv (mref.Name, mkILNonGenericBoxedTy mref.EnclosingTypeRef, mref.CallingConv, mref.ArgTypes, mref.ReturnType, None, mref.GenericArity)
+ let row = MethodRefInfoAsMemberRefRow cenv env fenv (mref.Name, mkILNonGenericBoxedTy mref.DeclaringTypeRef, mref.CallingConv, mref.ArgTypes, mref.ReturnType, None, mref.GenericArity)
FindOrAddSharedRow cenv TableNames.MemberRef row
and GetMethodRefAsCustomAttribType cenv (mref:ILMethodRef) =
let fenv = envForNonGenericMethodRef mref
- let tref = mref.EnclosingTypeRef
+ let tref = mref.DeclaringTypeRef
if isTypeRefLocal tref then
try (cat_MethodDef, GetMethodRefAsMethodDefIdx cenv mref)
with MethodDefNotFound -> (cat_MemberRef, GetMethodRefAsMemberRefIdx cenv fenv fenv mref)
@@ -1452,7 +1452,7 @@ and GenSecurityDeclsPass3 cenv hds attrs =
// --------------------------------------------------------------------
let rec GetFieldSpecAsMemberRefRow cenv env fenv (fspec:ILFieldSpec) =
- MemberRefRow (GetTypeAsMemberRefParent cenv env fspec.EnclosingType,
+ MemberRefRow (GetTypeAsMemberRefParent cenv env fspec.DeclaringType,
GetStringHeapIdx cenv fspec.Name,
GetFieldSpecSigAsBlobIdx cenv fenv fspec)
@@ -1472,7 +1472,7 @@ and GetFieldSpecSigAsBlobIdx cenv env x =
GetBytesAsBlobIdx cenv (GetFieldSpecSigAsBytes cenv env x)
and GetFieldSpecAsFieldDefOrRef cenv env (fspec:ILFieldSpec) =
- let typ = fspec.EnclosingType
+ let typ = fspec.DeclaringType
if isTypeLocal typ then
if not typ.IsNominal then failwith "GetFieldSpecAsFieldDefOrRef: unexpected local tref-typ"
let tref = typ.TypeRef
diff --git a/src/absil/ilx.fs b/src/absil/ilx.fs
index afe285ae73f..d28ff3d2f4f 100644
--- a/src/absil/ilx.fs
+++ b/src/absil/ilx.fs
@@ -49,7 +49,7 @@ type IlxUnionRef =
type IlxUnionSpec =
| IlxUnionSpec of IlxUnionRef * ILGenericArgs
- member x.EnclosingType = let (IlxUnionSpec(IlxUnionRef(bx, tref, _, _, _), inst)) = x in mkILNamedTy bx tref inst
+ member x.DeclaringType = let (IlxUnionSpec(IlxUnionRef(bx, tref, _, _, _), inst)) = x in mkILNamedTy bx tref inst
member x.Boxity = let (IlxUnionSpec(IlxUnionRef(bx, _, _, _, _), _)) = x in bx
member x.TypeRef = let (IlxUnionSpec(IlxUnionRef(_, tref, _, _, _), _)) = x in tref
member x.GenericArgs = let (IlxUnionSpec(_, inst)) = x in inst
diff --git a/src/absil/ilx.fsi b/src/absil/ilx.fsi
index 6ee5eceef12..39792635fe7 100644
--- a/src/absil/ilx.fsi
+++ b/src/absil/ilx.fsi
@@ -44,7 +44,7 @@ type IlxUnionRef =
type IlxUnionSpec =
| IlxUnionSpec of IlxUnionRef * ILGenericArgs
- member EnclosingType : ILType
+ member DeclaringType : ILType
member GenericArgs : ILGenericArgs
member Alternatives : IlxUnionAlternative list
member AlternativesArray : IlxUnionAlternative[]
diff --git a/src/buildfromsource/FSharp.Build/FSharp.Build.fsproj b/src/buildfromsource/FSharp.Build/FSharp.Build.fsproj
index 4fe08c815b5..f49ecb73381 100644
--- a/src/buildfromsource/FSharp.Build/FSharp.Build.fsproj
+++ b/src/buildfromsource/FSharp.Build/FSharp.Build.fsproj
@@ -17,7 +17,6 @@
FSBuild.resx
-
diff --git a/src/buildfromsource/FSharp.Compiler.Interactive.Settings/FSharp.Compiler.Interactive.Settings.fsproj b/src/buildfromsource/FSharp.Compiler.Interactive.Settings/FSharp.Compiler.Interactive.Settings.fsproj
index 7cea584c57f..406efaf8a03 100644
--- a/src/buildfromsource/FSharp.Compiler.Interactive.Settings/FSharp.Compiler.Interactive.Settings.fsproj
+++ b/src/buildfromsource/FSharp.Compiler.Interactive.Settings/FSharp.Compiler.Interactive.Settings.fsproj
@@ -18,7 +18,6 @@
FSInteractiveSettings.resx
-
diff --git a/src/buildfromsource/FSharp.Compiler.Private/FSComp.fs b/src/buildfromsource/FSharp.Compiler.Private/FSComp.fs
index abc321272d5..63c331ab68d 100644
--- a/src/buildfromsource/FSharp.Compiler.Private/FSComp.fs
+++ b/src/buildfromsource/FSharp.Compiler.Private/FSComp.fs
@@ -4300,6 +4300,9 @@ type internal SR private() =
/// An error occurred while reading the F# metadata of assembly '%s'. A reserved construct was utilized. You may need to upgrade your F# compiler or use an earlier version of the assembly that doesn't make use of a specific construct.
/// (Originally from ..\FSComp.txt:1424)
static member pickleUnexpectedNonZero(a0 : System.String) = (3219, GetStringFunc("pickleUnexpectedNonZero",",,,%s,,,") a0)
+ /// This method or property is not normally used from F# code, use an explicit tuple pattern for deconstruction instead.
+ /// (Originally from ..\FSComp.txt:1425)
+ static member tcTupleMemberNotNormallyUsed() = (3220, GetStringFunc("tcTupleMemberNotNormallyUsed",",,,") )
/// Call this method once to validate that all known resources are valid; throws if not
static member RunStartupValidation() =
@@ -5698,4 +5701,5 @@ type internal SR private() =
ignore(GetString("notAFunctionButMaybeDeclaration"))
ignore(GetString("ArgumentsInSigAndImplMismatch"))
ignore(GetString("pickleUnexpectedNonZero"))
+ ignore(GetString("tcTupleMemberNotNormallyUsed"))
()
diff --git a/src/buildfromsource/FSharp.Compiler.Private/FSComp.resx b/src/buildfromsource/FSharp.Compiler.Private/FSComp.resx
index 71f965fc9fa..04d5cf6a3b4 100644
--- a/src/buildfromsource/FSharp.Compiler.Private/FSComp.resx
+++ b/src/buildfromsource/FSharp.Compiler.Private/FSComp.resx
@@ -1120,7 +1120,7 @@
The member or object constructor '{0}' is not {1}
- The member or object constructor '{0}' is not {1}. Private members may only be accessed from within the declaring type. Protected members may only be accessed from an extending type and cannot be accessed from inner lambda expressions.
+ The member or object constructor '{0}' is not {1}. Private members may only be accessed from within the declaring type. Protected members may only be accessed from an extending type and cannot be accessed from within inner lambda expressions, object expressions or computation expressions (such as async { }). If {0} is a protected member, consider creating a member in this type that calls it.{0} is not a static method
@@ -4303,4 +4303,7 @@
An error occurred while reading the F# metadata of assembly '{0}'. A reserved construct was utilized. You may need to upgrade your F# compiler or use an earlier version of the assembly that doesn't make use of a specific construct.
+
+ This method or property is not normally used from F# code, use an explicit tuple pattern for deconstruction instead.
+
\ No newline at end of file
diff --git a/src/buildfromsource/FSharp.Compiler.Private/FSharp.Compiler.Private.fsproj b/src/buildfromsource/FSharp.Compiler.Private/FSharp.Compiler.Private.fsproj
index ef26074ad54..655cfa81140 100644
--- a/src/buildfromsource/FSharp.Compiler.Private/FSharp.Compiler.Private.fsproj
+++ b/src/buildfromsource/FSharp.Compiler.Private/FSharp.Compiler.Private.fsproj
@@ -608,9 +608,6 @@
InteractiveSession\fsi.fs
-
- Misc/InternalsVisibleTo.fs
-
Misc/MSBuildReferenceResolver.fs
diff --git a/src/buildfromsource/Fsc/Fsc.fsproj b/src/buildfromsource/Fsc/Fsc.fsproj
index 5ee390de338..58b44242fd4 100644
--- a/src/buildfromsource/Fsc/Fsc.fsproj
+++ b/src/buildfromsource/Fsc/Fsc.fsproj
@@ -15,7 +15,6 @@
-
Resources/AssemblyInfo.fs
diff --git a/src/fsharp/AccessibilityLogic.fs b/src/fsharp/AccessibilityLogic.fs
index af5842de44b..9bd6efd5b12 100644
--- a/src/fsharp/AccessibilityLogic.fs
+++ b/src/fsharp/AccessibilityLogic.fs
@@ -162,8 +162,8 @@ let private IsILTypeInfoAccessible amap m ad (tcrefOfViewedItem : TyconRef) =
check None (enc @ [tdef])
/// Indicates if an IL member associated with the given ILType is accessible
-let private IsILTypeAndMemberAccessible g amap m adType ad (ILTypeInfo(tcrefOfViewedItem, _, _, _)) access =
- IsILTypeInfoAccessible amap m adType tcrefOfViewedItem && IsILMemberAccessible g amap m tcrefOfViewedItem ad access
+let private IsILTypeAndMemberAccessible g amap m adType ad (typ: ILTypeInfo) access =
+ IsILTypeInfoAccessible amap m adType typ.TyconRefOfRawMetadata && IsILMemberAccessible g amap m typ.TyconRefOfRawMetadata ad access
/// Indicates if an entity is accessible
let IsEntityAccessible amap m ad (tcref:TyconRef) =
@@ -226,9 +226,9 @@ let IsILFieldInfoAccessible g amap m ad x =
match x with
| ILFieldInfo (tinfo,fd) -> IsILTypeAndMemberAccessible g amap m ad ad tinfo fd.Access
#if !NO_EXTENSIONTYPING
- | ProvidedField (amap, tpfi, m) as pfi ->
+ | ProvidedField (amap, tpfi, m) ->
let access = tpfi.PUntaint((fun fi -> ComputeILAccess fi.IsPublic fi.IsFamily fi.IsFamilyOrAssembly fi.IsFamilyAndAssembly), m)
- IsProvidedMemberAccessible amap m ad pfi.EnclosingType access
+ IsProvidedMemberAccessible amap m ad x.ApparentEnclosingType access
#endif
let GetILAccessOfILEventInfo (ILEventInfo (tinfo,edef)) =
@@ -314,12 +314,12 @@ let IsTypeAndMethInfoAccessible amap m adTyp ad = function
#if !NO_EXTENSIONTYPING
| ProvidedMeth(amap,tpmb,_,m) as etmi ->
let access = tpmb.PUntaint((fun mi -> ComputeILAccess mi.IsPublic mi.IsFamily mi.IsFamilyOrAssembly mi.IsFamilyAndAssembly), m)
- IsProvidedMemberAccessible amap m ad etmi.EnclosingType access
+ IsProvidedMemberAccessible amap m ad etmi.ApparentEnclosingType access
#endif
let IsMethInfoAccessible amap m ad minfo = IsTypeAndMethInfoAccessible amap m ad ad minfo
let IsPropInfoAccessible g amap m ad = function
- | ILProp (_,x) -> IsILPropInfoAccessible g amap m ad x
+ | ILProp ilpinfo -> IsILPropInfoAccessible g amap m ad ilpinfo
| FSProp (_,_,Some vref,_)
| FSProp (_,_,_,Some vref) -> IsValAccessible ad vref
#if !NO_EXTENSIONTYPING
@@ -334,7 +334,7 @@ let IsPropInfoAccessible g amap m ad = function
| None -> tryGetILAccessForProvidedMethodBase(ppi.GetSetMethod())
| x -> x), m)
defaultArg a ILMemberAccess.Public
- IsProvidedMemberAccessible amap m ad pp.EnclosingType access
+ IsProvidedMemberAccessible amap m ad pp.ApparentEnclosingType access
#endif
| _ -> false
diff --git a/src/fsharp/AttributeChecking.fs b/src/fsharp/AttributeChecking.fs
index 9a63092da47..50f0bb15189 100644
--- a/src/fsharp/AttributeChecking.fs
+++ b/src/fsharp/AttributeChecking.fs
@@ -81,7 +81,7 @@ type AttribInfo =
match x with
| FSAttribInfo(_g,Attrib(tcref,_,_,_,_,_,_)) -> tcref
| ILAttribInfo (g, amap, scoref, a, m) ->
- let ty = ImportILType scoref amap m [] a.Method.EnclosingType
+ let ty = ImportILType scoref amap m [] a.Method.DeclaringType
tcrefOfAppTy g ty
member x.ConstructorArguments =
@@ -154,7 +154,7 @@ let GetAttribInfosOfMethod amap m minfo =
let GetAttribInfosOfProp amap m pinfo =
match pinfo with
- | ILProp(g,ilpinfo) -> ilpinfo.RawMetadata.CustomAttrs |> AttribInfosOfIL g amap ilpinfo.ILTypeInfo.ILScopeRef m
+ | ILProp ilpinfo -> ilpinfo.RawMetadata.CustomAttrs |> AttribInfosOfIL ilpinfo.TcGlobals amap ilpinfo.ILTypeInfo.ILScopeRef m
| FSProp(g,_,Some vref,_)
| FSProp(g,_,_,Some vref) -> vref.Attribs |> AttribInfosOfFS g
| FSProp _ -> failwith "GetAttribInfosOfProp: unreachable"
@@ -165,7 +165,7 @@ let GetAttribInfosOfProp amap m pinfo =
let GetAttribInfosOfEvent amap m einfo =
match einfo with
- | ILEvent(g, x) -> x.RawMetadata.CustomAttrs |> AttribInfosOfIL g amap x.ILTypeInfo.ILScopeRef m
+ | ILEvent ileinfo -> ileinfo.RawMetadata.CustomAttrs |> AttribInfosOfIL einfo.TcGlobals amap ileinfo.ILTypeInfo.ILScopeRef m
| FSEvent(_, pi, _vref1, _vref2) -> GetAttribInfosOfProp amap m pi
#if !NO_EXTENSIONTYPING
// TODO: provided attributes
@@ -373,7 +373,7 @@ let CheckProvidedAttributesForUnseen (provAttribs: Tainted CheckILAttributes g pdef.CustomAttrs m
+ | ILProp(ILPropInfo(_,pdef)) -> CheckILAttributes pinfo.TcGlobals pdef.CustomAttrs m
| FSProp(g,_,Some vref,_)
| FSProp(g,_,_,Some vref) -> CheckFSharpAttributes g vref.Attribs m
| FSProp _ -> failwith "CheckPropInfoAttributes: unreachable"
@@ -419,7 +419,7 @@ let CheckMethInfoAttributes g m tyargsOpt minfo =
/// Indicate if a method has 'Obsolete', 'CompilerMessageAttribute' or 'TypeProviderEditorHideMethodsAttribute'.
/// Used to suppress the item in intellisense.
let MethInfoIsUnseen g m typ minfo =
- let isUnseenByObsoleteAttrib =
+ let isUnseenByObsoleteAttrib () =
match BindMethInfoAttributes m minfo
(fun ilAttribs -> Some(CheckILAttributesForUnseen g ilAttribs m))
(fun fsAttribs -> Some(CheckFSharpAttributesForUnseen g fsAttribs m))
@@ -432,11 +432,11 @@ let MethInfoIsUnseen g m typ minfo =
| Some res -> res
| None -> false
- let isUnseenByHidingAttribute =
+ let isUnseenByHidingAttribute () =
#if !NO_EXTENSIONTYPING
not (isObjTy g typ) &&
isAppTy g typ &&
- isObjTy g minfo.EnclosingType &&
+ isObjTy g minfo.ApparentEnclosingType &&
let tcref = tcrefOfAppTy g typ
match tcref.TypeReprInfo with
| TProvidedTypeExtensionPoint info ->
@@ -449,20 +449,26 @@ let MethInfoIsUnseen g m typ minfo =
// just to look at the attributes on IL methods.
if tcref.IsILTycon then
tcref.ILTyconRawMetadata.CustomAttrs.AsList
- |> List.exists (fun attr -> attr.Method.EnclosingType.TypeSpec.Name = typeof.FullName)
+ |> List.exists (fun attr -> attr.Method.DeclaringType.TypeSpec.Name = typeof.FullName)
else
false
#else
typ |> ignore
false
#endif
- isUnseenByObsoleteAttrib || isUnseenByHidingAttribute
+
+ //let isUnseenByBeingTupleMethod () = isAnyTupleTy g typ
+
+ isUnseenByObsoleteAttrib () || isUnseenByHidingAttribute () //|| isUnseenByBeingTupleMethod ()
/// Indicate if a property has 'Obsolete' or 'CompilerMessageAttribute'.
/// Used to suppress the item in intellisense.
let PropInfoIsUnseen m pinfo =
match pinfo with
- | ILProp (g,ILPropInfo(_,pdef)) -> CheckILAttributesForUnseen g pdef.CustomAttrs m
+ | ILProp (ILPropInfo(_,pdef) as ilpinfo) ->
+ // Properties on .NET tuple types are resolvable but unseen
+ isAnyTupleTy pinfo.TcGlobals ilpinfo.ILTypeInfo.ToType ||
+ CheckILAttributesForUnseen pinfo.TcGlobals pdef.CustomAttrs m
| FSProp (g,_,Some vref,_)
| FSProp (g,_,_,Some vref) -> CheckFSharpAttributesForUnseen g vref.Attribs m
| FSProp _ -> failwith "CheckPropInfoAttributes: unreachable"
diff --git a/src/fsharp/AugmentWithHashCompare.fs b/src/fsharp/AugmentWithHashCompare.fs
index 901edf9d6f5..7e914267bdf 100644
--- a/src/fsharp/AugmentWithHashCompare.fs
+++ b/src/fsharp/AugmentWithHashCompare.fs
@@ -858,7 +858,7 @@ let slotImplMethod (final,c,slotsig) : ValMemberInfo =
IsOverrideOrExplicitImpl=true
MemberKind=MemberKind.Member}
IsImplemented=false
- ApparentParent=c}
+ ApparentEnclosingEntity=c}
let nonVirtualMethod c : ValMemberInfo =
{ ImplementedSlotSigs=[]
@@ -868,7 +868,7 @@ let nonVirtualMethod c : ValMemberInfo =
IsOverrideOrExplicitImpl=false
MemberKind=MemberKind.Member}
IsImplemented=false
- ApparentParent=c}
+ ApparentEnclosingEntity=c}
let unitArg = ValReprInfo.unitArgData
let unaryArg = [ ValReprInfo.unnamedTopArg ]
diff --git a/src/fsharp/CompileOps.fs b/src/fsharp/CompileOps.fs
index 91dc8bb83bd..8558c29b3e3 100644
--- a/src/fsharp/CompileOps.fs
+++ b/src/fsharp/CompileOps.fs
@@ -532,11 +532,11 @@ let UseOfAddressOfOperatorE() = DeclareResourceString("UseOfAddressOfOperator",
let DefensiveCopyWarningE() = DeclareResourceString("DefensiveCopyWarning", "%s")
let DeprecatedThreadStaticBindingWarningE() = DeclareResourceString("DeprecatedThreadStaticBindingWarning", "")
let FunctionValueUnexpectedE() = DeclareResourceString("FunctionValueUnexpected", "%s")
-let UnitTypeExpectedE() = DeclareResourceString("UnitTypeExpected", "")
-let UnitTypeExpectedWithEqualityE() = DeclareResourceString("UnitTypeExpectedWithEquality", "")
-let UnitTypeExpectedWithPossiblePropertySetterE() = DeclareResourceString("UnitTypeExpectedWithPossiblePropertySetter", "%s%s")
-let UnitTypeExpectedWithPossibleAssignmentE() = DeclareResourceString("UnitTypeExpectedWithPossibleAssignment", "%s")
-let UnitTypeExpectedWithPossibleAssignmentToMutableE() = DeclareResourceString("UnitTypeExpectedWithPossibleAssignmentToMutable", "%s")
+let UnitTypeExpectedE() = DeclareResourceString("UnitTypeExpected", "%s")
+let UnitTypeExpectedWithEqualityE() = DeclareResourceString("UnitTypeExpectedWithEquality", "%s")
+let UnitTypeExpectedWithPossiblePropertySetterE() = DeclareResourceString("UnitTypeExpectedWithPossiblePropertySetter", "%s%s%s")
+let UnitTypeExpectedWithPossibleAssignmentE() = DeclareResourceString("UnitTypeExpectedWithPossibleAssignment", "%s%s")
+let UnitTypeExpectedWithPossibleAssignmentToMutableE() = DeclareResourceString("UnitTypeExpectedWithPossibleAssignmentToMutable", "%s%s")
let RecursiveUseCheckedAtRuntimeE() = DeclareResourceString("RecursiveUseCheckedAtRuntime", "")
let LetRecUnsound1E() = DeclareResourceString("LetRecUnsound1", "%s")
let LetRecUnsound2E() = DeclareResourceString("LetRecUnsound2", "%s%s")
@@ -1249,7 +1249,7 @@ let OutputPhasedErrorR (os:StringBuilder) (err:PhasedDiagnostic) =
| _ :: ts -> hasUnitTType_app ts
| [] -> false
- match minfoVirt.EnclosingType with
+ match minfoVirt.ApparentEnclosingType with
| TType_app (t, types) when t.IsFSharpInterfaceTycon && hasUnitTType_app types ->
// match abstract member with 'unit' passed as generic argument
os.Append(OverrideDoesntOverride4E().Format sig1) |> ignore
@@ -1292,28 +1292,32 @@ let OutputPhasedErrorR (os:StringBuilder) (err:PhasedDiagnostic) =
os.Append(DeprecatedThreadStaticBindingWarningE().Format) |> ignore
| FunctionValueUnexpected (denv, ty, _) ->
- // REVIEW: consider if we need to show _cxs (the type parameter constraints)
let ty, _cxs = PrettyTypes.PrettifyType denv.g ty
- os.Append(FunctionValueUnexpectedE().Format (NicePrint.stringOfTy denv ty)) |> ignore
+ let errorText = FunctionValueUnexpectedE().Format (NicePrint.stringOfTy denv ty)
+ os.Append errorText |> ignore
- | UnitTypeExpected (_, _, _) ->
- let warningText = UnitTypeExpectedE().Format
+ | UnitTypeExpected (denv, ty, _) ->
+ let ty, _cxs = PrettyTypes.PrettifyType denv.g ty
+ let warningText = UnitTypeExpectedE().Format (NicePrint.stringOfTy denv ty)
os.Append warningText |> ignore
- | UnitTypeExpectedWithEquality (_) ->
- let warningText = UnitTypeExpectedWithEqualityE().Format
+ | UnitTypeExpectedWithEquality (denv, ty, _) ->
+ let ty, _cxs = PrettyTypes.PrettifyType denv.g ty
+ let warningText = UnitTypeExpectedWithEqualityE().Format (NicePrint.stringOfTy denv ty)
os.Append warningText |> ignore
- | UnitTypeExpectedWithPossiblePropertySetter (_, _, bindingName, propertyName, _) ->
- let warningText = UnitTypeExpectedWithPossiblePropertySetterE().Format bindingName propertyName
+ | UnitTypeExpectedWithPossiblePropertySetter (denv, ty, bindingName, propertyName, _) ->
+ let ty, _cxs = PrettyTypes.PrettifyType denv.g ty
+ let warningText = UnitTypeExpectedWithPossiblePropertySetterE().Format (NicePrint.stringOfTy denv ty) bindingName propertyName
os.Append warningText |> ignore
- | UnitTypeExpectedWithPossibleAssignment (_, _, isAlreadyMutable, bindingName, _) ->
+ | UnitTypeExpectedWithPossibleAssignment (denv, ty, isAlreadyMutable, bindingName, _) ->
+ let ty, _cxs = PrettyTypes.PrettifyType denv.g ty
let warningText =
if isAlreadyMutable then
- UnitTypeExpectedWithPossibleAssignmentToMutableE().Format bindingName
+ UnitTypeExpectedWithPossibleAssignmentToMutableE().Format (NicePrint.stringOfTy denv ty) bindingName
else
- UnitTypeExpectedWithPossibleAssignmentE().Format bindingName
+ UnitTypeExpectedWithPossibleAssignmentE().Format (NicePrint.stringOfTy denv ty) bindingName
os.Append warningText |> ignore
| RecursiveUseCheckedAtRuntime _ ->
@@ -1347,8 +1351,8 @@ let OutputPhasedErrorR (os:StringBuilder) (err:PhasedDiagnostic) =
| NonUniqueInferredAbstractSlot(_, denv, bindnm, bvirt1, bvirt2, _) ->
os.Append(NonUniqueInferredAbstractSlot1E().Format bindnm) |> ignore
- let ty1 = bvirt1.EnclosingType
- let ty2 = bvirt2.EnclosingType
+ let ty1 = bvirt1.ApparentEnclosingType
+ let ty2 = bvirt2.ApparentEnclosingType
// REVIEW: consider if we need to show _cxs (the type parameter constraints)
let t1, t2, _cxs = NicePrint.minimalStringsOfTwoTypes denv ty1 ty2
os.Append(NonUniqueInferredAbstractSlot2E().Format) |> ignore
@@ -2283,9 +2287,7 @@ type TcConfigBuilder =
mutable optSettings : Optimizer.OptimizationSettings
mutable emitTailcalls : bool
mutable deterministic : bool
-#if PREFERRED_UI_LANG
mutable preferredUiLang: string option
-#endif
mutable lcid : int option
mutable productNameForBannerText : string
/// show the MS (c) notice, e.g. with help or fsi?
@@ -2444,9 +2446,7 @@ type TcConfigBuilder =
optSettings = Optimizer.OptimizationSettings.Defaults
emitTailcalls = true
deterministic = false
-#if PREFERRED_UI_LANG
preferredUiLang = None
-#endif
lcid = None
// See bug 6071 for product banner spec
productNameForBannerText = FSComp.SR.buildProductName(FSharpEnvironment.FSharpBannerVersion)
@@ -2910,9 +2910,7 @@ type TcConfig private (data : TcConfigBuilder, validate:bool) =
member x.optSettings = data.optSettings
member x.emitTailcalls = data.emitTailcalls
member x.deterministic = data.deterministic
-#if PREFERRED_UI_LANG
member x.preferredUiLang = data.preferredUiLang
-#endif
member x.lcid = data.lcid
member x.optsOn = data.optsOn
member x.productNameForBannerText = data.productNameForBannerText
diff --git a/src/fsharp/CompileOps.fsi b/src/fsharp/CompileOps.fsi
index ad6a7f1648e..1d7d2b1f775 100755
--- a/src/fsharp/CompileOps.fsi
+++ b/src/fsharp/CompileOps.fsi
@@ -331,9 +331,7 @@ type TcConfigBuilder =
mutable optSettings : Optimizer.OptimizationSettings
mutable emitTailcalls: bool
mutable deterministic: bool
-#if PREFERRED_UI_LANG
mutable preferredUiLang: string option
-#endif
mutable lcid : int option
mutable productNameForBannerText: string
mutable showBanner : bool
@@ -481,11 +479,7 @@ type TcConfig =
member optSettings : Optimizer.OptimizationSettings
member emitTailcalls: bool
member deterministic: bool
-#if PREFERRED_UI_LANG
member preferredUiLang: string option
-#else
- member lcid : int option
-#endif
member optsOn : bool
member productNameForBannerText: string
member showBanner : bool
diff --git a/src/fsharp/CompileOptions.fs b/src/fsharp/CompileOptions.fs
index 1c78fd9aa33..7f9c71b633e 100644
--- a/src/fsharp/CompileOptions.fs
+++ b/src/fsharp/CompileOptions.fs
@@ -739,10 +739,8 @@ let codePageFlag (tcConfigB : TcConfigBuilder) =
tcConfigB.inputCodePage <- Some(n)), None,
Some (FSComp.SR.optsCodepage()))
-#if PREFERRED_UI_LANG
let preferredUiLang (tcConfigB: TcConfigBuilder) =
CompilerOption("preferreduilang", tagString, OptionString (fun s -> tcConfigB.preferredUiLang <- Some(s)), None, Some(FSComp.SR.optsPreferredUiLang()))
-#endif
let utf8OutputFlag (tcConfigB: TcConfigBuilder) =
CompilerOption("utf8output", tagNone, OptionUnit (fun () -> tcConfigB.utf8output <- true), None,
@@ -771,9 +769,7 @@ let advancedFlagsBoth tcConfigB =
[
yield codePageFlag tcConfigB
yield utf8OutputFlag tcConfigB
-#if PREFERRED_UI_LANG
yield preferredUiLang tcConfigB
-#endif
yield fullPathsFlag tcConfigB
yield libFlag tcConfigB
yield CompilerOption("simpleresolution",
@@ -849,11 +845,7 @@ let testFlag tcConfigB =
let vsSpecificFlags (tcConfigB: TcConfigBuilder) =
[ CompilerOption("vserrors", tagNone, OptionUnit (fun () -> tcConfigB.errorStyle <- ErrorStyle.VSErrors), None, None)
CompilerOption("validate-type-providers", tagNone, OptionUnit (id), None, None) // preserved for compatibility's sake, no longer has any effect
-#if PREFERRED_UI_LANG
CompilerOption("LCID", tagInt, OptionInt (fun _n -> ()), None, None)
-#else
- CompilerOption("LCID", tagInt, OptionInt (fun n -> tcConfigB.lcid <- Some(n)), None, None)
-#endif
CompilerOption("flaterrors", tagNone, OptionUnit (fun () -> tcConfigB.flatErrors <- true), None, None)
CompilerOption("sqmsessionguid", tagNone, OptionString (fun s -> tcConfigB.sqmSessionGuid <- try System.Guid(s) |> Some with e -> None), None, None)
CompilerOption("gccerrors", tagNone, OptionUnit (fun () -> tcConfigB.errorStyle <- ErrorStyle.GccErrors), None, None)
diff --git a/src/fsharp/ConstraintSolver.fs b/src/fsharp/ConstraintSolver.fs
index d247366288e..9758d9859b4 100644
--- a/src/fsharp/ConstraintSolver.fs
+++ b/src/fsharp/ConstraintSolver.fs
@@ -1035,7 +1035,7 @@ and SolveMemberConstraint (csenv:ConstraintSolverEnv) permitWeakResolution ndeep
| _, _, false, ("op_Addition" | "op_Subtraction" | "op_Modulus"), [argty1;argty2]
when // Ignore any explicit +/- overloads from any basic integral types
- (minfos |> List.forall (fun minfo -> isIntegerTy g minfo.EnclosingType ) &&
+ (minfos |> List.forall (fun minfo -> isIntegerTy g minfo.ApparentEnclosingType ) &&
( (IsNumericOrIntegralEnumType g argty1 || (nm = "op_Addition" && (isCharTy g argty1 || isStringTy g argty1))) && (permitWeakResolution || not (isTyparTy g argty2))
|| (IsNumericOrIntegralEnumType g argty2 || (nm = "op_Addition" && (isCharTy g argty2 || isStringTy g argty2))) && (permitWeakResolution || not (isTyparTy g argty1)))) ->
SolveTypEqualsTypKeepAbbrevs csenv ndeep m2 trace argty2 argty1 ++ (fun () ->
@@ -1044,7 +1044,7 @@ and SolveMemberConstraint (csenv:ConstraintSolverEnv) permitWeakResolution ndeep
| _, _, false, ("op_LessThan" | "op_LessThanOrEqual" | "op_GreaterThan" | "op_GreaterThanOrEqual" | "op_Equality" | "op_Inequality" ), [argty1;argty2]
when // Ignore any explicit overloads from any basic integral types
- (minfos |> List.forall (fun minfo -> isIntegerTy g minfo.EnclosingType ) &&
+ (minfos |> List.forall (fun minfo -> isIntegerTy g minfo.ApparentEnclosingType ) &&
( (IsRelationalType g argty1 && (permitWeakResolution || not (isTyparTy g argty2)))
|| (IsRelationalType g argty2 && (permitWeakResolution || not (isTyparTy g argty1))))) ->
SolveTypEqualsTypKeepAbbrevs csenv ndeep m2 trace argty2 argty1 ++ (fun () ->
@@ -1286,9 +1286,9 @@ and SolveMemberConstraint (csenv:ConstraintSolverEnv) permitWeakResolution ndeep
let isInstance = minfo.IsInstance
if isInstance <> memFlags.IsInstance then
if isInstance then
- ErrorD(ConstraintSolverError(FSComp.SR.csMethodFoundButIsNotStatic((NicePrint.minimalStringOfType denv minfo.EnclosingType), (DecompileOpName nm), nm), m, m2 ))
+ ErrorD(ConstraintSolverError(FSComp.SR.csMethodFoundButIsNotStatic((NicePrint.minimalStringOfType denv minfo.ApparentEnclosingType), (DecompileOpName nm), nm), m, m2 ))
else
- ErrorD(ConstraintSolverError(FSComp.SR.csMethodFoundButIsStatic((NicePrint.minimalStringOfType denv minfo.EnclosingType), (DecompileOpName nm), nm), m, m2 ))
+ ErrorD(ConstraintSolverError(FSComp.SR.csMethodFoundButIsStatic((NicePrint.minimalStringOfType denv minfo.ApparentEnclosingType), (DecompileOpName nm), nm), m, m2 ))
else
CheckMethInfoAttributes g m None minfo ++ (fun () ->
ResultD (TTraitSolved (minfo, calledMeth.CalledTyArgs))))
@@ -1337,7 +1337,7 @@ and MemberConstraintSolutionOfMethInfo css m minfo minst =
match minfo with
| ILMeth(_, ilMeth, _) ->
let mref = IL.mkRefToILMethod (ilMeth.DeclaringTyconRef.CompiledRepresentationForNamedType, ilMeth.RawMetadata)
- let iltref = ilMeth.DeclaringTyconRefOption |> Option.map (fun tcref -> tcref.CompiledRepresentationForNamedType)
+ let iltref = ilMeth.ILExtensionMethodDeclaringTyconRef |> Option.map (fun tcref -> tcref.CompiledRepresentationForNamedType)
ILMethSln(ilMeth.ApparentEnclosingType, iltref, mref, minst)
| FSMeth(_, typ, vref, _) ->
FSMethSln(typ, vref, minst)
@@ -1348,7 +1348,7 @@ and MemberConstraintSolutionOfMethInfo css m minfo minst =
let g = amap.g
let minst = [] // GENERIC TYPE PROVIDERS: for generics, we would have an minst here
let allArgVars, allArgs = minfo.GetParamTypes(amap, m, minst) |> List.concat |> List.mapi (fun i ty -> mkLocal m ("arg"+string i) ty) |> List.unzip
- let objArgVars, objArgs = (if minfo.IsInstance then [mkLocal m "this" minfo.EnclosingType] else []) |> List.unzip
+ let objArgVars, objArgs = (if minfo.IsInstance then [mkLocal m "this" minfo.ApparentEnclosingType] else []) |> List.unzip
let callMethInfoOpt, callExpr, callExprTy = ProvidedMethodCalls.BuildInvokerExpressionForProvidedMethodCall css.TcVal (g, amap, mi, objArgs, NeverMutates, false, ValUseFlag.NormalValUse, allArgs, m)
let closedExprSln = ClosedExprSln (mkLambdas m [] (objArgVars@allArgVars) (callExpr, callExprTy) )
// If the call is a simple call to an IL method with all the arguments in the natural order, then revert to use ILMethSln.
@@ -2040,7 +2040,7 @@ and ReportNoCandidatesError (csenv:ConstraintSolverEnv) (nUnnamedCallerArgs, nNa
| CallerNamedArg(id, _) :: _ ->
if minfo.IsConstructor then
let predictFields() =
- minfo.DeclaringEntityRef.AllInstanceFieldsAsList
+ minfo.DeclaringTyconRef.AllInstanceFieldsAsList
|> List.map (fun p -> p.Name.Replace("@", ""))
|> System.Collections.Generic.HashSet
@@ -2207,7 +2207,7 @@ and ResolveOverloading
if isOpConversion then
match calledMethGroup, reqdRetTyOpt with
| h :: _, Some rty ->
- Some (h.Method.EnclosingType, rty)
+ Some (h.Method.ApparentEnclosingType, rty)
| _ -> None
else
None
@@ -2598,15 +2598,16 @@ let CodegenWitnessThatTypSupportsTraitConstraint tcVal g amap m (traitInfo:Trait
| None -> Choice4Of4()
| Some sln ->
match sln with
- | ILMethSln(typ, extOpt, mref, minst) ->
- let tcref, _tinst = destAppTy g typ
+ | ILMethSln(origTy, extOpt, mref, minst) ->
+ let metadataTy = helpEnsureTypeHasMetadata g origTy
+ let tcref, _tinst = destAppTy g metadataTy
let mdef = IL.resolveILMethodRef tcref.ILTyconRawMetadata mref
let ilMethInfo =
match extOpt with
- | None -> MethInfo.CreateILMeth(amap, m, typ, mdef)
+ | None -> MethInfo.CreateILMeth(amap, m, origTy, mdef)
| Some ilActualTypeRef ->
let actualTyconRef = Import.ImportILTypeRef amap m ilActualTypeRef
- MethInfo.CreateILExtensionMeth(amap, m, typ, actualTyconRef, None, mdef)
+ MethInfo.CreateILExtensionMeth(amap, m, origTy, actualTyconRef, None, mdef)
Choice1Of4 (ilMethInfo, minst)
| FSMethSln(typ, vref, minst) ->
Choice1Of4 (FSMeth(g, typ, vref, None), minst)
diff --git a/src/fsharp/ExtensionTyping.fs b/src/fsharp/ExtensionTyping.fs
index d348e13c585..b1d46b8eba7 100755
--- a/src/fsharp/ExtensionTyping.fs
+++ b/src/fsharp/ExtensionTyping.fs
@@ -38,6 +38,7 @@ module internal ExtensionTyping =
// Specify the tooling-compatible fragments of a path such as:
// typeproviders/fsharp41/net461/MyProvider.DesignTime.dll
+ // tools/fsharp41/net461/MyProvider.DesignTime.dll
// See https://github.com/Microsoft/visualfsharp/issues/3736
// Represents the FF#-compiler <-> type provider protocol.
@@ -55,16 +56,12 @@ module internal ExtensionTyping =
System.Diagnostics.Debug.Assert(false, "Couldn't determine runtime tooling context, assuming it supports at least .NET Standard 2.0")
[ "netstandard2.0"]
- // When significant new processor types appear add a new moniker here. Note that use of this qualifier will be very rare
- // and we don't expect different design-time assemblies will be needed for different architectures very often. Some
- // exceptions may be design-time components for type providers for systems such as Python or R.
- let toolingCompatibleArch() = if sizeof = 8 then "x64" else "x86"
+
let toolingCompatiblePaths() =
[ for protocol in toolingCompatibleTypeProviderProtocolMonikers() do
- for netRuntime in toolingCompatibleVersions() do
- let dir = Path.Combine("typeproviders", protocol, netRuntime)
- yield Path.Combine(dir, toolingCompatibleArch())
- yield dir
+ for netRuntime in toolingCompatibleVersions() do
+ yield Path.Combine("typeproviders", protocol, netRuntime)
+ yield Path.Combine("tools", protocol, netRuntime)
]
/// Load a the design-time part of a type-provider into the host process, and look for types
diff --git a/src/fsharp/FSComp.txt b/src/fsharp/FSComp.txt
index 5778f3dd92a..2ca518ff532 100644
--- a/src/fsharp/FSComp.txt
+++ b/src/fsharp/FSComp.txt
@@ -1421,3 +1421,4 @@ notAFunctionButMaybeIndexer,"This expression is not a function and cannot be app
notAFunctionButMaybeDeclaration,"This value is not a function and cannot be applied. Did you forget to terminate a declaration?"
3218,ArgumentsInSigAndImplMismatch,"The argument names in the signature '%s' and implementation '%s' do not match. The argument name from the signature file will be used. This may cause problems when debugging or profiling."
3219,pickleUnexpectedNonZero,"An error occurred while reading the F# metadata of assembly '%s'. A reserved construct was utilized. You may need to upgrade your F# compiler or use an earlier version of the assembly that doesn't make use of a specific construct."
+3220,tcTupleMemberNotNormallyUsed,"This method or property is not normally used from F# code, use an explicit tuple pattern for deconstruction instead."
diff --git a/src/fsharp/FSStrings.resx b/src/fsharp/FSStrings.resx
index 29df23d2296..eb8a8f975cf 100644
--- a/src/fsharp/FSStrings.resx
+++ b/src/fsharp/FSStrings.resx
@@ -886,19 +886,19 @@
This expression is a function value, i.e. is missing arguments. Its type is {0}.
- The result of this expression is implicitly ignored. Consider using 'ignore' to discard this value explicitly, e.g. 'expr |> ignore', or 'let' to bind the result to a name, e.g. 'let result = expr'.
+ The result of this expression has type '{0}' and is implicitly ignored. Consider using 'ignore' to discard this value explicitly, e.g. 'expr |> ignore', or 'let' to bind the result to a name, e.g. 'let result = expr'.
- The result of this equality expression is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'.
+ The result of this equality expression has type '{0}' and is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'.
- The result of this equality expression is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to set a value to a property, then use the '<-' operator e.g. '{0}.{1} <- expression'.
+ The result of this equality expression has type '{0}' and is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to set a value to a property, then use the '<-' operator e.g. '{1}.{2} <- expression'.
- The result of this equality expression is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to mutate a value, then mark the value 'mutable' and use the '<-' operator e.g. '{0} <- expression'.
+ The result of this equality expression has type '{0}' and is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to mutate a value, then mark the value 'mutable' and use the '<-' operator e.g. '{1} <- expression'.
- The result of this equality expression is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to mutate a value, then use the '<-' operator e.g. '{0} <- expression'.
+ The result of this equality expression has type '{0}' and is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to mutate a value, then use the '<-' operator e.g. '{1} <- expression'.This recursive use will be checked for initialization-soundness at runtime. This warning is usually harmless, and may be suppressed by using '#nowarn "21"' or '--nowarn:21'.
diff --git a/src/fsharp/FSharp.Build-proto/FSharp.Build-proto.fsproj b/src/fsharp/FSharp.Build-proto/FSharp.Build-proto.fsproj
index 8aba433807d..8ab9e33c93f 100644
--- a/src/fsharp/FSharp.Build-proto/FSharp.Build-proto.fsproj
+++ b/src/fsharp/FSharp.Build-proto/FSharp.Build-proto.fsproj
@@ -72,7 +72,7 @@
-
+ $(FSharpSourcesRoot)\..\packages\Microsoft.VisualFSharp.Msbuild.15.0.1.0.1\lib\net45\Microsoft.Build.Framework.dll
@@ -90,5 +90,19 @@
FSharp.Core
+
+
+ $(FSharpSourcesRoot)\..\packages\Microsoft.Build.Framework.14.3.0\lib\net45\Microsoft.Build.Framework.dll
+
+
+ $(FSharpSourcesRoot)\..\packages\Microsoft.Build.14.3.0\lib\net45\Microsoft.Build.dll
+
+
+ $(FSharpSourcesRoot)\..\packages\Microsoft.Build.Utilities.Core.14.3.0\lib\net45\Microsoft.Build.Utilities.Core.dll
+
+
+ $(FSharpSourcesRoot)\..\packages\Microsoft.Build.Tasks.Core.14.3.0\lib\net45\Microsoft.Build.Tasks.Core.dll
+
+
diff --git a/src/fsharp/FSharp.Build/FSharp.Build.fsproj b/src/fsharp/FSharp.Build/FSharp.Build.fsproj
index e432279f749..a24d03a6ac3 100644
--- a/src/fsharp/FSharp.Build/FSharp.Build.fsproj
+++ b/src/fsharp/FSharp.Build/FSharp.Build.fsproj
@@ -53,13 +53,13 @@
-
+
-
+ $(FSharpSourcesRoot)\..\packages\Microsoft.VisualFSharp.Msbuild.15.0.1.0.1\lib\net45\Microsoft.Build.Framework.dll
@@ -73,6 +73,20 @@
$(FSharpSourcesRoot)\..\packages\Microsoft.VisualFSharp.Msbuild.15.0.1.0.1\lib\net45\Microsoft.Build.Tasks.Core.dll
+
+
+ $(FSharpSourcesRoot)\..\packages\Microsoft.Build.Framework.14.3.0\lib\net45\Microsoft.Build.Framework.dll
+
+
+ $(FSharpSourcesRoot)\..\packages\Microsoft.Build.14.3.0\lib\net45\Microsoft.Build.dll
+
+
+ $(FSharpSourcesRoot)\..\packages\Microsoft.Build.Utilities.Core.14.3.0\lib\net45\Microsoft.Build.Utilities.Core.dll
+
+
+ $(FSharpSourcesRoot)\..\packages\Microsoft.Build.Tasks.Core.14.3.0\lib\net45\Microsoft.Build.Tasks.Core.dll
+
+ {DED3BBD7-53F4-428A-8C9F-27968E768605}
diff --git a/src/fsharp/FSharp.Build/Microsoft.FSharp.NetSdk.targets b/src/fsharp/FSharp.Build/Microsoft.FSharp.NetSdk.targets
index ceb5be04943..c8f72b909a4 100644
--- a/src/fsharp/FSharp.Build/Microsoft.FSharp.NetSdk.targets
+++ b/src/fsharp/FSharp.Build/Microsoft.FSharp.NetSdk.targets
@@ -73,4 +73,31 @@ WARNING: DO NOT MODIFY this file unless you are knowledgeable about MSBuild and
+
+ $(TargetsForTfmSpecificContentInPackage);PackageFSharpDesignTimeTools
+
+
+
+
+ fsharp41
+ tools
+
+
+
+
+
+
+ <_ResolvedProjectOutputFiles
+ Include="%(_ResolvedProjectReferencePaths.RootDir)%(_ResolvedProjectReferencePaths.Directory)/**/*"
+ Exclude="%(_ResolvedProjectReferencePaths.RootDir)%(_ResolvedProjectReferencePaths.Directory)/**/FSharp.Core.dll;%(_ResolvedProjectReferencePaths.RootDir)%(_ResolvedProjectReferencePaths.Directory)/**/System.ValueTuple.dll"
+ Condition="'%(_ResolvedProjectReferencePaths.IsFSharpDesignTimeProvider)' == 'true'">
+ %(_ResolvedProjectReferencePaths.NearestTargetFramework)
+
+
+
+ $(FSharpToolsDirectory)/$(FSharpDesignTimeProtocol)/%(_ResolvedProjectOutputFiles.NearestTargetFramework)/%(_ResolvedProjectOutputFiles.FileName)%(_ResolvedProjectOutputFiles.Extension)
+
+
+
+
diff --git a/src/fsharp/FSharp.Compiler.Interactive.Settings/InternalsVisibleTo.fs b/src/fsharp/FSharp.Compiler.Interactive.Settings/InternalsVisibleTo.fs
deleted file mode 100644
index 3071a74b616..00000000000
--- a/src/fsharp/FSharp.Compiler.Interactive.Settings/InternalsVisibleTo.fs
+++ /dev/null
@@ -1,10 +0,0 @@
-// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information.
-
-namespace Microsoft.FSharp
-open System.Reflection
-[]
-[]
-[]
-
-do()
-
diff --git a/src/fsharp/FSharp.Compiler.Private/FSharp.Compiler.Private.fsproj b/src/fsharp/FSharp.Compiler.Private/FSharp.Compiler.Private.fsproj
index e871d61d4c7..0d135f2ee15 100644
--- a/src/fsharp/FSharp.Compiler.Private/FSharp.Compiler.Private.fsproj
+++ b/src/fsharp/FSharp.Compiler.Private/FSharp.Compiler.Private.fsproj
@@ -642,17 +642,17 @@
FSIstrings.txt
- InteractiveSession\fsi.fsi
+ InteractiveSession/fsi.fsi
- InteractiveSession\fsi.fs
+ InteractiveSession/fsi.fs
-
+
Misc/MSBuildReferenceResolver.fs
-
+
Misc/LegacyHostedCompilerForTesting.fs
@@ -684,6 +684,8 @@
..\..\..\packages\System.ValueTuple.4.3.1\lib\netstandard1.0\System.ValueTuple.dlltrue
+
+ $(FSharpSourcesRoot)\..\packages\Microsoft.VisualFSharp.Msbuild.15.0.1.0.1\lib\net45\Microsoft.Build.Framework.dll
diff --git a/src/fsharp/FSharp.Core/FSharp.Core.fsproj b/src/fsharp/FSharp.Core/FSharp.Core.fsproj
index f24ede9f1b2..32c5f015302 100644
--- a/src/fsharp/FSharp.Core/FSharp.Core.fsproj
+++ b/src/fsharp/FSharp.Core/FSharp.Core.fsproj
@@ -34,7 +34,7 @@
PreserveNewest
-
+ false
diff --git a/src/fsharp/Fsc-proto/Fsc-proto.fsproj b/src/fsharp/Fsc-proto/Fsc-proto.fsproj
index fd3d209e512..8c49f5fcf6a 100644
--- a/src/fsharp/Fsc-proto/Fsc-proto.fsproj
+++ b/src/fsharp/Fsc-proto/Fsc-proto.fsproj
@@ -438,7 +438,10 @@
fsc.fs
-
+
+ Service/SimulatedMSBuildReferenceResolver.fs
+
+
MSBuildReferenceResolver.fs
@@ -473,7 +476,7 @@
FSharp.Core
-
+ $(FSharpSourcesRoot)\..\packages\Microsoft.VisualFSharp.Msbuild.15.0.1.0.1\lib\net45\Microsoft.Build.Framework.dll
diff --git a/src/fsharp/IlxGen.fs b/src/fsharp/IlxGen.fs
index 13e1f5bd67f..4de82a8d7e6 100644
--- a/src/fsharp/IlxGen.fs
+++ b/src/fsharp/IlxGen.fs
@@ -767,7 +767,7 @@ let GetMethodSpecForMemberVal amap g (memberInfo:ValMemberInfo) (vref:ValRef) =
let flatArgInfos = List.concat curriedArgInfos
let isCtor = (memberInfo.MemberFlags.MemberKind = MemberKind.Constructor)
let cctor = (memberInfo.MemberFlags.MemberKind = MemberKind.ClassConstructor)
- let parentTcref = vref.TopValActualParent
+ let parentTcref = vref.TopValDeclaringEntity
let parentTypars = parentTcref.TyparsNoRange
let numParentTypars = parentTypars.Length
if tps.Length < numParentTypars then error(InternalError("CodeGen check: type checking did not ensure that this method is sufficiently generic", m))
@@ -1505,7 +1505,7 @@ let GenConstArray cenv (cgbuf:CodeGenBuffer) eenv ilElementType (data:'a[]) (wri
let ilFieldDef = { ilFieldDef with CustomAttrs = mkILCustomAttrs [ cenv.g.DebuggerBrowsableNeverAttribute ] }
let fspec = mkILFieldSpecInTy (mkILTyForCompLoc eenv.cloc,ilFieldName, fty)
CountStaticFieldDef()
- cgbuf.mgbuf.AddFieldDef(fspec.EnclosingTypeRef,ilFieldDef)
+ cgbuf.mgbuf.AddFieldDef(fspec.DeclaringTypeRef,ilFieldDef)
CG.EmitInstrs cgbuf
(pop 0)
(Push [ ilArrayType; ilArrayType; cenv.g.iltyp_RuntimeFieldHandle ])
@@ -2171,7 +2171,7 @@ and GenAllocExn cenv cgbuf eenv (c,args,m) sequel =
and GenAllocUnionCase cenv cgbuf eenv (c,tyargs,args,m) sequel =
GenExprs cenv cgbuf eenv args
let cuspec,idx = GenUnionCaseSpec cenv.amap m eenv.tyenv c tyargs
- CG.EmitInstrs cgbuf (pop args.Length) (Push [cuspec.EnclosingType]) (EraseUnions.mkNewData cenv.g.ilg (cuspec, idx))
+ CG.EmitInstrs cgbuf (pop args.Length) (Push [cuspec.DeclaringType]) (EraseUnions.mkNewData cenv.g.ilg (cuspec, idx))
GenSequel cenv eenv.cloc cgbuf sequel
and GenAllocRecd cenv cgbuf eenv ctorInfo (tcref,argtys,args,m) sequel =
@@ -2361,7 +2361,7 @@ and GenSetUnionCaseField cenv cgbuf eenv (e,ucref,tyargs,n,e2,m) sequel =
let cuspec,idx = GenUnionCaseSpec cenv.amap m eenv.tyenv ucref tyargs
let avoidHelpers = entityRefInThisAssembly cenv.g.compilingFslib ucref.TyconRef
EraseUnions.emitCastData cenv.g.ilg (UnionCodeGen cgbuf) (false,avoidHelpers,cuspec,idx)
- CG.EmitInstrs cgbuf (pop 1) (Push [cuspec.EnclosingType]) [ ] // push/pop to match the line above
+ CG.EmitInstrs cgbuf (pop 1) (Push [cuspec.DeclaringType]) [ ] // push/pop to match the line above
GenExpr cenv cgbuf eenv SPSuppress e2 Continue
CG.EmitInstrs cgbuf (pop 2) Push0 (EraseUnions.mkStData (cuspec, idx, n))
GenUnitThenSequel cenv eenv m eenv.cloc cgbuf sequel
@@ -2406,7 +2406,7 @@ and GenFieldGet isStatic cenv cgbuf eenv (rfref:RecdFieldRef,tyargs,m) =
CG.EmitInstrs cgbuf (mk_field_pops isStatic 0) (Push [fspec.ActualType]) [ instr ]
else
let cconv = if isStatic then ILCallingConv.Static else ILCallingConv.Instance
- let mspec = mkILMethSpecInTy (fspec.EnclosingType,cconv, "get_" + rfref.RecdField.rfield_id.idText, [], fspec.FormalType, [])
+ let mspec = mkILMethSpecInTy (fspec.DeclaringType,cconv, "get_" + rfref.RecdField.rfield_id.idText, [], fspec.FormalType, [])
CG.EmitInstr cgbuf (mk_field_pops isStatic 0) (Push [fspec.ActualType]) (mkNormalCall mspec)
and GenFieldStore isStatic cenv cgbuf eenv (rfref:RecdFieldRef,tyargs,m) sequel =
@@ -2414,7 +2414,7 @@ and GenFieldStore isStatic cenv cgbuf eenv (rfref:RecdFieldRef,tyargs,m) sequel
let fld = rfref.RecdField
if fld.IsMutable && not (useGenuineField rfref.Tycon fld) then
let cconv = if isStatic then ILCallingConv.Static else ILCallingConv.Instance
- let mspec = mkILMethSpecInTy (fspec.EnclosingType, cconv, "set_" + fld.rfield_id.idText, [fspec.FormalType],ILType.Void,[])
+ let mspec = mkILMethSpecInTy (fspec.DeclaringType, cconv, "set_" + fld.rfield_id.idText, [fspec.FormalType],ILType.Void,[])
CG.EmitInstr cgbuf (mk_field_pops isStatic 1) Push0 (mkNormalCall mspec)
else
let vol = if rfref.RecdField.IsVolatile then Volatile else Nonvolatile
@@ -2603,14 +2603,14 @@ and GenApp cenv cgbuf eenv (f,fty,tyargs,args,m) sequel =
let numEnclILTypeArgs =
match vref.MemberInfo with
| Some _ when not (vref.IsExtensionMember) ->
- List.length(vref.MemberApparentParent.TyparsNoRange |> DropErasedTypars)
+ List.length(vref.MemberApparentEntity.TyparsNoRange |> DropErasedTypars)
| _ -> 0
let (ilEnclArgTys,ilMethArgTys) =
if ilTyArgs.Length < numEnclILTypeArgs then error(InternalError("length mismatch",m))
List.chop numEnclILTypeArgs ilTyArgs
- let boxity = mspec.EnclosingType.Boxity
+ let boxity = mspec.DeclaringType.Boxity
let mspec = mkILMethSpec (mspec.MethodRef, boxity,ilEnclArgTys,ilMethArgTys)
// "Unit" return types on static methods become "void"
@@ -2645,7 +2645,7 @@ and GenApp cenv cgbuf eenv (f,fty,tyargs,args,m) sequel =
// ok, now we're ready to generate
if isSuperInit || isSelfInit then
- CG.EmitInstrs cgbuf (pop 0) (Push [mspec.EnclosingType ]) [ mkLdarg0 ]
+ CG.EmitInstrs cgbuf (pop 0) (Push [mspec.DeclaringType ]) [ mkLdarg0 ]
GenUntupledArgsDiscardingLoneUnit cenv cgbuf eenv m vref.NumObjArgs curriedArgInfos nowArgs
@@ -2668,7 +2668,7 @@ and GenApp cenv cgbuf eenv (f,fty,tyargs,args,m) sequel =
(if mustGenerateUnitAfterCall || isSuperInit || isSelfInit then Push0 else (Push [(GenType cenv.amap m eenv.tyenv actualRetTy)])) callInstr
// For isSuperInit, load the 'this' pointer as the pretend 'result' of the operation. It will be popped again in most cases
- if isSuperInit then CG.EmitInstrs cgbuf (pop 0) (Push [mspec.EnclosingType]) [ mkLdarg0 ]
+ if isSuperInit then CG.EmitInstrs cgbuf (pop 0) (Push [mspec.DeclaringType]) [ mkLdarg0 ]
// When generating debug code, generate a 'nop' after a 'call' that returns 'void'
// This is what C# does, as it allows the call location to be maintained correctly in the stack frame
@@ -3098,8 +3098,8 @@ and GenAsmCode cenv cgbuf eenv (il,tyargs,args,returnTys,m) sequel =
if isNil ilTyArgs then
fspec
else
- {fspec with EnclosingType=
- let ty = fspec.EnclosingType
+ {fspec with DeclaringType=
+ let ty = fspec.DeclaringType
let tspec = ty.TypeSpec
mkILTy ty.Boxity (mkILTySpec(tspec.TypeRef, ilTyArgs)) }
match i,ilTyArgs with
@@ -3306,7 +3306,7 @@ and GenILCall cenv cgbuf eenv (virt,valu,newobj,valUseFlags,isDllImport,ilMethRe
// Load the 'this' pointer to pass to the superclass constructor. This argument is not
// in the expression tree since it can't be treated like an ordinary value
- if isSuperInit then CG.EmitInstrs cgbuf (pop 0) (Push [ilMethSpec.EnclosingType]) [ mkLdarg0 ]
+ if isSuperInit then CG.EmitInstrs cgbuf (pop 0) (Push [ilMethSpec.DeclaringType]) [ mkLdarg0 ]
GenExprs cenv cgbuf eenv argExprs
let il =
if newobj then [ I_newobj(ilMethSpec,None) ]
@@ -3323,7 +3323,7 @@ and GenILCall cenv cgbuf eenv (virt,valu,newobj,valUseFlags,isDllImport,ilMethRe
// Load the 'this' pointer as the pretend 'result' of the isSuperInit operation.
// It will be immediately popped in most cases, but may also be used as the target of some "property set" operations.
- if isSuperInit then CG.EmitInstrs cgbuf (pop 0) (Push [ilMethSpec.EnclosingType]) [ mkLdarg0 ]
+ if isSuperInit then CG.EmitInstrs cgbuf (pop 0) (Push [ilMethSpec.DeclaringType]) [ mkLdarg0 ]
CommitCallSequel cenv eenv m eenv.cloc cgbuf mustGenerateUnitAfterCall sequel
and CommitCallSequel cenv eenv m cloc cgbuf mustGenerateUnitAfterCall sequel =
@@ -4699,7 +4699,7 @@ and GenBindingAfterSequencePoint cenv cgbuf eenv sp (TBind(vspec,rhsExpr,_)) sta
// Workaround for .NET and Visual Studio restriction w.r.t debugger type proxys
// Mark internal constructors in internal classes as public.
let access =
- if access = ILMemberAccess.Assembly && vspec.IsConstructor && IsHiddenTycon eenv.sigToImplRemapInfo vspec.MemberApparentParent.Deref then
+ if access = ILMemberAccess.Assembly && vspec.IsConstructor && IsHiddenTycon eenv.sigToImplRemapInfo vspec.MemberApparentEntity.Deref then
ILMemberAccess.Public
else
access
@@ -4713,7 +4713,7 @@ and GenBindingAfterSequencePoint cenv cgbuf eenv sp (TBind(vspec,rhsExpr,_)) sta
CommitStartScope cgbuf startScopeMarkOpt
// The initialization code for static 'let' and 'do' bindings gets compiled into the initialization .cctor for the whole file
- | _ when vspec.IsClassConstructor && isNil vspec.TopValActualParent.TyparsNoRange ->
+ | _ when vspec.IsClassConstructor && isNil vspec.TopValDeclaringEntity.TyparsNoRange ->
let tps,_,_,_,cctorBody,_ = IteratedAdjustArityOfLambda cenv.g cenv.amap vspec.ValReprInfo.Value rhsExpr
let eenv = EnvForTypars tps eenv
CommitStartScope cgbuf startScopeMarkOpt
@@ -4740,7 +4740,7 @@ and GenBindingAfterSequencePoint cenv cgbuf eenv sp (TBind(vspec,rhsExpr,_)) sta
Init = None
Args = []
CustomAttrs = mkILCustomAttrs ilAttribs }
- cgbuf.mgbuf.AddOrMergePropertyDef(ilGetterMethSpec.MethodRef.EnclosingTypeRef, ilPropDef,m)
+ cgbuf.mgbuf.AddOrMergePropertyDef(ilGetterMethSpec.MethodRef.DeclaringTypeRef, ilPropDef,m)
let ilMethodDef =
let ilMethodBody = MethodBody.IL(CodeGenMethodForExpr cenv cgbuf.mgbuf (SPSuppress, [], ilGetterMethSpec.Name, eenv, 0, 0, rhsExpr, Return))
@@ -4749,7 +4749,7 @@ and GenBindingAfterSequencePoint cenv cgbuf eenv sp (TBind(vspec,rhsExpr,_)) sta
|> AddNonUserCompilerGeneratedAttribs cenv.g
CountMethodDef()
- cgbuf.mgbuf.AddMethodDef(ilGetterMethSpec.MethodRef.EnclosingTypeRef, ilMethodDef)
+ cgbuf.mgbuf.AddMethodDef(ilGetterMethSpec.MethodRef.DeclaringTypeRef, ilMethodDef)
CommitStartScope cgbuf startScopeMarkOpt
match optShadowLocal with
@@ -4794,7 +4794,7 @@ and GenBindingAfterSequencePoint cenv cgbuf eenv sp (TBind(vspec,rhsExpr,_)) sta
{ ilFieldDef with
CustomAttrs = mkILCustomAttrs (ilAttribs @ [ cenv.g.DebuggerBrowsableNeverAttribute ]) }
- [ (fspec.EnclosingTypeRef, ilFieldDef) ]
+ [ (fspec.DeclaringTypeRef, ilFieldDef) ]
let ilTypeRefForProperty = ilTyForProperty.TypeRef
@@ -5066,7 +5066,7 @@ and GenEventForProperty cenv eenvForMeth (mspec:ILMethodSpec) (v:Val) ilAttrsTha
let evname = v.PropertyName
let delegateTy = Infos.FindDelegateTypeOfPropertyEvent cenv.g cenv.amap evname m returnTy
let ilDelegateTy = GenType cenv.amap m eenvForMeth.tyenv delegateTy
- let ilThisTy = mspec.EnclosingType
+ let ilThisTy = mspec.DeclaringType
let addMethRef = mkILMethRef (ilThisTy.TypeRef,mspec.CallingConv,"add_" + evname,0,[ilDelegateTy],ILType.Void)
let removeMethRef = mkILMethRef (ilThisTy.TypeRef,mspec.CallingConv,"remove_" + evname,0,[ilDelegateTy],ILType.Void)
{ Type = Some(ilDelegateTy)
@@ -5087,7 +5087,7 @@ and ComputeFlagFixupsForMemberBinding cenv (v:Val,memberInfo:ValMemberInfo) =
memberInfo.ImplementedSlotSigs |> List.map (fun slotsig ->
let oty = slotsig.ImplementedType
let otcref,_ = destAppTy cenv.g oty
- let tcref = v.MemberApparentParent
+ let tcref = v.MemberApparentEntity
let useMethodImpl =
// REVIEW: it would be good to get rid of this special casing of Compare and GetHashCode during code generation
@@ -5238,7 +5238,7 @@ and GenMethodForBinding
let ilParams = GenParams cenv eenv mspec paramInfos (Some(nonUnitNonSelfMethodVars))
let ilReturn = GenReturnInfo cenv eenv mspec.FormalReturnType retInfo
let methName = mspec.Name
- let tref = mspec.MethodRef.EnclosingTypeRef
+ let tref = mspec.MethodRef.DeclaringTypeRef
let EmitTheMethodDef mdef =
// Does the function have an explicit [] attribute?
@@ -5275,7 +5275,7 @@ and GenMethodForBinding
()
| Some(memberInfo) when not v.IsExtensionMember ->
- let ilMethTypars = ilTypars |> List.drop mspec.EnclosingType.GenericArgs.Length
+ let ilMethTypars = ilTypars |> List.drop mspec.DeclaringType.GenericArgs.Length
if memberInfo.MemberFlags.MemberKind = MemberKind.Constructor then
assert (isNil ilMethTypars)
let mdef = mkILCtor (access,ilParams,ilMethodBody)
@@ -5309,7 +5309,7 @@ and GenMethodForBinding
let isAbstract =
memberInfo.MemberFlags.IsDispatchSlot &&
- let tcref = v.MemberApparentParent
+ let tcref = v.MemberApparentEntity
not tcref.Deref.IsFSharpDelegateTycon
let mdef =
@@ -7016,7 +7016,7 @@ let LookupGeneratedValue (amap:ImportMap) (ctxt: ExecutionContext) eenv (v:Val)
| StaticField (fspec, _, hasLiteralAttr, ilContainerTy, _, _, ilGetterMethRef, _, _) ->
let obj =
if hasLiteralAttr then
- let staticTyp = ctxt.LookupTypeRef fspec.EnclosingTypeRef
+ let staticTyp = ctxt.LookupTypeRef fspec.DeclaringTypeRef
// Checked: This FieldInfo (FieldBuilder) supports GetValue().
staticTyp.GetField(fspec.Name).GetValue(null:obj)
else
@@ -7030,7 +7030,7 @@ let LookupGeneratedValue (amap:ImportMap) (ctxt: ExecutionContext) eenv (v:Val)
| StaticProperty (ilGetterMethSpec, _) ->
let obj =
- let staticTyp = ctxt.LookupTypeRef ilGetterMethSpec.MethodRef.EnclosingTypeRef
+ let staticTyp = ctxt.LookupTypeRef ilGetterMethSpec.MethodRef.DeclaringTypeRef
// We can't call .Invoke on the ILMethodRef's MethodInfo,
// because it is the MethodBuilder and that does not support Invoke.
// Rather, we look for the getter MethodInfo from the built type and .Invoke on that.
@@ -7057,7 +7057,7 @@ let ClearGeneratedValue (ctxt: ExecutionContext) (_g:TcGlobals) eenv (v:Val) =
match StorageForVal v.Range v eenv with
| StaticField (fspec, _, hasLiteralAttr, _, _, _, _ilGetterMethRef, ilSetterMethRef, _) ->
if not hasLiteralAttr && v.IsMutable then
- let staticTyp = ctxt.LookupTypeRef ilSetterMethRef.EnclosingTypeRef
+ let staticTyp = ctxt.LookupTypeRef ilSetterMethRef.DeclaringTypeRef
let typ = ctxt.LookupType fspec.ActualType
let methInfo = staticTyp.GetMethod(ilSetterMethRef.Name, BindingFlags.Static ||| BindingFlags.Public ||| BindingFlags.NonPublic)
diff --git a/src/fsharp/InfoReader.fs b/src/fsharp/InfoReader.fs
index 25f7547e473..eabc0bf862c 100644
--- a/src/fsharp/InfoReader.fs
+++ b/src/fsharp/InfoReader.fs
@@ -4,6 +4,8 @@
/// Select members from a type by name, searching the type hierarchy if needed
module internal Microsoft.FSharp.Compiler.InfoReader
+open System.Collections.Generic
+
open Microsoft.FSharp.Compiler.AbstractIL.IL
open Microsoft.FSharp.Compiler.AbstractIL.Internal.Library
@@ -46,12 +48,10 @@ let TrySelectMemberVal g optFilter typ pri _membInfo (vref:ValRef) =
else
None
-/// Query the immediate methods of an F# type, not taking into account inherited methods. The optFilter
-/// parameter is an optional name to restrict the set of properties returned.
-let GetImmediateIntrinsicMethInfosOfType (optFilter,ad) g amap m typ =
- let minfos =
+let rec GetImmediateIntrinsicMethInfosOfTypeAux (optFilter,ad) g amap m origTy metadataTy =
- match metadataOfTy g typ with
+ let minfos =
+ match metadataOfTy g metadataTy with
#if !NO_EXTENSIONTYPING
| ProvidedTypeMetadata info ->
let st = info.ProvidedType
@@ -59,33 +59,48 @@ let GetImmediateIntrinsicMethInfosOfType (optFilter,ad) g amap m typ =
match optFilter with
| Some name -> st.PApplyArray ((fun st -> st.GetMethods() |> Array.filter (fun mi -> mi.Name = name) ), "GetMethods", m)
| None -> st.PApplyArray ((fun st -> st.GetMethods()), "GetMethods", m)
- [ for mi in meths -> ProvidedMeth(amap,mi.Coerce(m),None,m) ]
+ [ for mi in meths -> ProvidedMeth(amap, mi.Coerce(m), None, m) ]
#endif
- | ILTypeMetadata (TILObjectReprData(_,_,tdef)) ->
- let mdefs = tdef.Methods
- let mdefs = (match optFilter with None -> mdefs.AsList | Some nm -> mdefs.FindByName nm)
- mdefs |> List.map (fun mdef -> MethInfo.CreateILMeth(amap, m, typ, mdef))
+ | ILTypeMetadata _ ->
+ let tinfo = ILTypeInfo.FromType g origTy
+ let mdefs = tinfo.RawMetadata.Methods
+ let mdefs = match optFilter with None -> mdefs.AsList | Some nm -> mdefs.FindByName nm
+ mdefs |> List.map (fun mdef -> MethInfo.CreateILMeth(amap, m, origTy, mdef))
+
| FSharpOrArrayOrByrefOrTupleOrExnTypeMetadata ->
- match tryDestAppTy g typ with
- | None -> []
- | Some tcref ->
- SelectImmediateMemberVals g optFilter (TrySelectMemberVal g optFilter typ None) tcref
+ // Tuple types also support the properties Item1-8, Rest from the compiled tuple type
+ // In this case convert to the .NET Tuple type that carries metadata and try again
+ if isAnyTupleTy g metadataTy then
+ let betterMetadataTy = helpEnsureTypeHasMetadata g metadataTy
+ GetImmediateIntrinsicMethInfosOfTypeAux (optFilter,ad) g amap m origTy betterMetadataTy
+ else
+ match tryDestAppTy g metadataTy with
+ | None -> []
+ | Some tcref ->
+ SelectImmediateMemberVals g optFilter (TrySelectMemberVal g optFilter origTy None) tcref
let minfos = minfos |> List.filter (IsMethInfoAccessible amap m ad)
minfos
+/// Query the immediate methods of an F# type, not taking into account inherited methods. The optFilter
+/// parameter is an optional name to restrict the set of properties returned.
+let GetImmediateIntrinsicMethInfosOfType (optFilter,ad) g amap m typ =
+ GetImmediateIntrinsicMethInfosOfTypeAux (optFilter,ad) g amap m typ typ
+
/// A helper type to help collect properties.
///
/// Join up getters and setters which are not associated in the F# data structure
-type PropertyCollector(g,amap,m,typ,optFilter,ad) =
+type PropertyCollector(g, amap, m, typ, optFilter, ad) =
let hashIdentity =
- Microsoft.FSharp.Collections.HashIdentity.FromFunctions
+ HashIdentity.FromFunctions
(fun (pinfo:PropInfo) -> hash pinfo.PropertyName)
(fun pinfo1 pinfo2 ->
pinfo1.IsStatic = pinfo2.IsStatic &&
PropInfosEquivByNameAndPartialSig EraseNone g amap m pinfo1 pinfo2 &&
pinfo1.IsDefiniteFSharpOverride = pinfo2.IsDefiniteFSharpOverride )
- let props = new System.Collections.Generic.Dictionary(hashIdentity)
+
+ let props = new Dictionary(hashIdentity)
+
let add pinfo =
if props.ContainsKey(pinfo) then
match props.[pinfo], pinfo with
@@ -115,12 +130,10 @@ type PropertyCollector(g,amap,m,typ,optFilter,ad) =
member x.Close() = [ for KeyValue(_,pinfo) in props -> pinfo ]
-/// Query the immediate properties of an F# type, not taking into account inherited properties. The optFilter
-/// parameter is an optional name to restrict the set of properties returned.
-let GetImmediateIntrinsicPropInfosOfType (optFilter,ad) g amap m typ =
- let pinfos =
+let rec GetImmediateIntrinsicPropInfosOfTypeAux (optFilter,ad) g amap m origTy metadataTy =
- match metadataOfTy g typ with
+ let pinfos =
+ match metadataOfTy g metadataTy with
#if !NO_EXTENSIONTYPING
| ProvidedTypeMetadata info ->
let st = info.ProvidedType
@@ -133,27 +146,38 @@ let GetImmediateIntrinsicPropInfosOfType (optFilter,ad) g amap m typ =
| None ->
st.PApplyArray((fun st -> st.GetProperties()), "GetProperties", m)
matchingProps
- |> Seq.map(fun pi -> ProvidedProp(amap,pi,m))
+ |> Seq.map(fun pi -> ProvidedProp(amap, pi, m))
|> List.ofSeq
#endif
- | ILTypeMetadata (TILObjectReprData(_,_,tdef)) ->
- let tinfo = ILTypeInfo.FromType g typ
- let pdefs = tdef.Properties
+
+ | ILTypeMetadata _ ->
+ let tinfo = ILTypeInfo.FromType g origTy
+ let pdefs = tinfo.RawMetadata.Properties
let pdefs = match optFilter with None -> pdefs.AsList | Some nm -> pdefs.LookupByName nm
- pdefs |> List.map (fun pd -> ILProp(g,ILPropInfo(tinfo,pd)))
+ pdefs |> List.map (fun pdef -> ILProp(ILPropInfo(tinfo, pdef)))
+
| FSharpOrArrayOrByrefOrTupleOrExnTypeMetadata ->
- match tryDestAppTy g typ with
- | None -> []
- | Some tcref ->
- let propCollector = new PropertyCollector(g,amap,m,typ,optFilter,ad)
- SelectImmediateMemberVals g None
- (fun membInfo vref -> propCollector.Collect(membInfo,vref); None)
- tcref |> ignore
- propCollector.Close()
+ // Tuple types also support the properties Item1-8, Rest from the compiled tuple type
+ // In this case convert to the .NET Tuple type that carries metadata and try again
+ if isAnyTupleTy g metadataTy then
+ let betterMetadataTy = helpEnsureTypeHasMetadata g metadataTy
+ GetImmediateIntrinsicPropInfosOfTypeAux (optFilter,ad) g amap m origTy betterMetadataTy
+ else
+ match tryDestAppTy g metadataTy with
+ | None -> []
+ | Some tcref ->
+ let propCollector = new PropertyCollector(g, amap, m, origTy, optFilter, ad)
+ SelectImmediateMemberVals g None (fun membInfo vref -> propCollector.Collect(membInfo, vref); None) tcref |> ignore
+ propCollector.Close()
let pinfos = pinfos |> List.filter (IsPropInfoAccessible g amap m ad)
pinfos
+/// Query the immediate properties of an F# type, not taking into account inherited properties. The optFilter
+/// parameter is an optional name to restrict the set of properties returned.
+let rec GetImmediateIntrinsicPropInfosOfType (optFilter,ad) g amap m typ =
+ GetImmediateIntrinsicPropInfosOfTypeAux (optFilter,ad) g amap m typ typ
+
// Checks whether the given type has an indexer property.
let IsIndexerType g amap typ =
isArray1DTy g typ ||
@@ -161,9 +185,9 @@ let IsIndexerType g amap typ =
match tryDestAppTy g typ with
| Some tcref ->
let _, entityTy = generalizeTyconRef tcref
- let props = GetImmediateIntrinsicPropInfosOfType (None, AccessibleFromSomeFSharpCode) g amap range0 entityTy
+ let props = GetImmediateIntrinsicPropInfosOfType (None, AccessibleFromSomeFSharpCode) g amap range0 entityTy
props |> List.exists (fun x -> x.PropertyName = "Item")
- | _ -> false
+ | None -> false
/// Sets of methods up the hierarchy, ignoring duplicates by name and sig.
@@ -178,10 +202,10 @@ type HierarchyItem =
/// An InfoReader is an object to help us read and cache infos.
/// We create one of these for each file we typecheck.
-type InfoReader(g:TcGlobals, amap:Import.ImportMap) =
+type InfoReader(g: TcGlobals, amap: Import.ImportMap) =
/// Get the declared IL fields of a type, not including inherited fields
- let GetImmediateIntrinsicILFieldsOfType (optFilter,ad) m typ =
+ let GetImmediateIntrinsicILFieldsOfType (optFilter, ad) m typ =
let infos =
match metadataOfTy g typ with
#if !NO_EXTENSIONTYPING
@@ -195,9 +219,9 @@ type InfoReader(g:TcGlobals, amap:Import.ImportMap) =
| Tainted.Null -> []
| fi -> [ ProvidedField(amap,fi,m) ]
#endif
- | ILTypeMetadata (TILObjectReprData(_,_,tdef)) ->
+ | ILTypeMetadata _ ->
let tinfo = ILTypeInfo.FromType g typ
- let fdefs = tdef.Fields
+ let fdefs = tinfo.RawMetadata.Fields
let fdefs = match optFilter with None -> fdefs.AsList | Some nm -> fdefs.LookupByName nm
fdefs |> List.map (fun pd -> ILFieldInfo(tinfo,pd))
| FSharpOrArrayOrByrefOrTupleOrExnTypeMetadata ->
@@ -205,8 +229,8 @@ type InfoReader(g:TcGlobals, amap:Import.ImportMap) =
let infos = infos |> List.filter (IsILFieldInfoAccessible g amap m ad)
infos
- /// Get the declared events of a type, not including inherited events
- let ComputeImmediateIntrinsicEventsOfType (optFilter,ad) m typ =
+ /// Get the declared events of a type, not including inherited events, and not including F#-declared CLIEvents
+ let ComputeImmediateIntrinsicEventsOfType (optFilter, ad) m typ =
let infos =
match metadataOfTy g typ with
#if !NO_EXTENSIONTYPING
@@ -220,14 +244,14 @@ type InfoReader(g:TcGlobals, amap:Import.ImportMap) =
| Tainted.Null -> []
| ei -> [ ProvidedEvent(amap,ei,m) ]
#endif
- | ILTypeMetadata (TILObjectReprData(_,_,tdef)) ->
+ | ILTypeMetadata _ ->
let tinfo = ILTypeInfo.FromType g typ
- let edefs = tdef.Events
+ let edefs = tinfo.RawMetadata.Events
let edefs = match optFilter with None -> edefs.AsList | Some nm -> edefs.LookupByName nm
[ for edef in edefs do
- let einfo = ILEventInfo(tinfo,edef)
- if IsILEventInfoAccessible g amap m ad einfo then
- yield ILEvent(g,einfo) ]
+ let ileinfo = ILEventInfo(tinfo,edef)
+ if IsILEventInfoAccessible g amap m ad ileinfo then
+ yield ILEvent ileinfo ]
| FSharpOrArrayOrByrefOrTupleOrExnTypeMetadata ->
[]
infos
@@ -237,7 +261,7 @@ type InfoReader(g:TcGlobals, amap:Import.ImportMap) =
RecdFieldInfo(argsOfAppTy g typ,tcref.MakeNestedRecdFieldRef fspec)
/// Get the F#-declared record fields or class 'val' fields of a type
- let GetImmediateIntrinsicRecdOrClassFieldsOfType (optFilter,_ad) _m typ =
+ let GetImmediateIntrinsicRecdOrClassFieldsOfType (optFilter, _ad) _m typ =
match tryDestAppTy g typ with
| None -> []
| Some tcref ->
@@ -283,7 +307,7 @@ type InfoReader(g:TcGlobals, amap:Import.ImportMap) =
let optFilter = Some nm
FoldPrimaryHierarchyOfType (fun typ acc ->
let minfos = GetImmediateIntrinsicMethInfosOfType (optFilter,ad) g amap m typ
- let pinfos = GetImmediateIntrinsicPropInfosOfType (optFilter,ad) g amap m typ
+ let pinfos = GetImmediateIntrinsicPropInfosOfType (optFilter,ad) g amap m typ
let finfos = GetImmediateIntrinsicILFieldsOfType (optFilter,ad) m typ
let einfos = ComputeImmediateIntrinsicEventsOfType (optFilter,ad) m typ
let rfinfos = GetImmediateIntrinsicRecdOrClassFieldsOfType (optFilter,ad) m typ
@@ -414,41 +438,48 @@ type InfoReader(g:TcGlobals, amap:Import.ImportMap) =
primaryTypeHierarchyCache.Apply((allowMultiIntfInst,m,typ))
-//-------------------------------------------------------------------------
-// Constructor infos
-
-
/// Get the declared constructors of any F# type
-let GetIntrinsicConstructorInfosOfType (infoReader:InfoReader) m ty =
+let rec GetIntrinsicConstructorInfosOfTypeAux (infoReader:InfoReader) m origTy metadataTy =
protectAssemblyExploration [] (fun () ->
let g = infoReader.g
let amap = infoReader.amap
- if isAppTy g ty then
- match metadataOfTy g ty with
+ match metadataOfTy g metadataTy with
#if !NO_EXTENSIONTYPING
- | ProvidedTypeMetadata info ->
- let st = info.ProvidedType
- [ for ci in st.PApplyArray((fun st -> st.GetConstructors()), "GetConstructors", m) do
- yield ProvidedMeth(amap,ci.Coerce(m),None,m) ]
+ | ProvidedTypeMetadata info ->
+ let st = info.ProvidedType
+ [ for ci in st.PApplyArray((fun st -> st.GetConstructors()), "GetConstructors", m) do
+ yield ProvidedMeth(amap,ci.Coerce(m),None,m) ]
#endif
- | ILTypeMetadata _ ->
- let tinfo = ILTypeInfo.FromType g ty
- tinfo.RawMetadata.Methods.FindByName ".ctor"
- |> List.filter (fun md -> match md.mdKind with MethodKind.Ctor -> true | _ -> false)
- |> List.map (fun mdef -> MethInfo.CreateILMeth (amap, m, ty, mdef))
-
- | FSharpOrArrayOrByrefOrTupleOrExnTypeMetadata ->
- let tcref = tcrefOfAppTy g ty
- tcref.MembersOfFSharpTyconByName
- |> NameMultiMap.find ".ctor"
- |> List.choose(fun vref ->
- match vref.MemberInfo with
- | Some membInfo when (membInfo.MemberFlags.MemberKind = MemberKind.Constructor) -> Some vref
- | _ -> None)
- |> List.map (fun x -> FSMeth(g,ty,x,None))
- else []
+ | ILTypeMetadata _ ->
+ let tinfo = ILTypeInfo.FromType g origTy
+ tinfo.RawMetadata.Methods.FindByName ".ctor"
+ |> List.filter (fun md -> match md.mdKind with MethodKind.Ctor -> true | _ -> false)
+ |> List.map (fun mdef -> MethInfo.CreateILMeth (amap, m, origTy, mdef))
+
+ | FSharpOrArrayOrByrefOrTupleOrExnTypeMetadata ->
+ // Tuple types also support the properties Item1-8, Rest from the compiled tuple type
+ // In this case convert to the .NET Tuple type that carries metadata and try again
+ if isAnyTupleTy g metadataTy then
+ let betterMetadataTy = helpEnsureTypeHasMetadata g metadataTy
+ GetIntrinsicConstructorInfosOfTypeAux infoReader m origTy betterMetadataTy
+ else
+ match tryDestAppTy g metadataTy with
+ | None -> []
+ | Some tcref ->
+ tcref.MembersOfFSharpTyconByName
+ |> NameMultiMap.find ".ctor"
+ |> List.choose(fun vref ->
+ match vref.MemberInfo with
+ | Some membInfo when (membInfo.MemberFlags.MemberKind = MemberKind.Constructor) -> Some vref
+ | _ -> None)
+ |> List.map (fun x -> FSMeth(g, origTy, x, None))
)
+let GetIntrinsicConstructorInfosOfType infoReader m typ =
+ GetIntrinsicConstructorInfosOfTypeAux infoReader m typ typ
+
+
+
//-------------------------------------------------------------------------
// Collecting methods and properties taking into account hiding rules in the hierarchy
@@ -601,7 +632,7 @@ let ExcludeHiddenOfMethInfos g amap m (minfos:MethInfo list list) =
(fun minfo -> minfo.LogicalName)
(fun m1 m2 ->
// only hide those truly from super classes
- not (tyconRefEq g (tcrefOfAppTy g m1.EnclosingType) (tcrefOfAppTy g m2.EnclosingType)) &&
+ not (tyconRefEq g m1.DeclaringTyconRef m2.DeclaringTyconRef) &&
MethInfosEquivByNameAndPartialSig EraseNone true g amap m m1 m2)
|> List.concat
diff --git a/src/fsharp/MethodCalls.fs b/src/fsharp/MethodCalls.fs
index fd442d1f09e..31e2c960f32 100644
--- a/src/fsharp/MethodCalls.fs
+++ b/src/fsharp/MethodCalls.fs
@@ -295,7 +295,7 @@ type CalledMeth<'T>
[]
let assignedNamedProps,unassignedNamedItems =
- let returnedObjTy = if minfo.IsConstructor then minfo.EnclosingType else methodRetTy
+ let returnedObjTy = if minfo.IsConstructor then minfo.ApparentEnclosingType else methodRetTy
unassignedNamedItems |> List.splitChoose (fun (CallerNamedArg(id,e) as arg) ->
let nm = id.idText
let pinfos = GetIntrinsicPropInfoSetsOfType infoReader (Some(nm),ad,AllowMultiIntfInstantiations.Yes) IgnoreOverrides id.idRange returnedObjTy
@@ -509,7 +509,7 @@ let IsBaseCall objArgs =
let ComputeConstrainedCallInfo g amap m (objArgs,minfo:MethInfo) =
match objArgs with
| [objArgExpr] when not minfo.IsExtensionMember ->
- let methObjTy = minfo.EnclosingType
+ let methObjTy = minfo.ApparentEnclosingType
let objArgTy = tyOfExpr g objArgExpr
if TypeDefinitelySubsumesTypeNoCoercion 0 g amap m methObjTy objArgTy
// Constrained calls to class types can only ever be needed for the three class types that
@@ -546,8 +546,8 @@ let TakeObjAddrForMethodCall g amap (minfo:MethInfo) isMutable m objArgs f =
// Extension members and calls to class constraints may need a coercion for their object argument
let objArgExpr' =
if Option.isNone ccallInfo && // minfo.IsExtensionMember && minfo.IsStruct &&
- not (TypeDefinitelySubsumesTypeNoCoercion 0 g amap m minfo.EnclosingType objArgTy) then
- mkCoerceExpr(objArgExpr',minfo.EnclosingType,m,objArgTy)
+ not (TypeDefinitelySubsumesTypeNoCoercion 0 g amap m minfo.ApparentEnclosingType objArgTy) then
+ mkCoerceExpr(objArgExpr',minfo.ApparentEnclosingType,m,objArgTy)
else
objArgExpr'
@@ -717,7 +717,7 @@ let BuildMethodCall tcVal g amap isMutable m isProp minfo valUseFlags minst objA
// TODO: there is a fair bit of duplication here with mk_il_minfo_call. We should be able to merge these
/// Build an expression node that is a call to a extension method in a generated assembly
- let enclTy = minfo.EnclosingType
+ let enclTy = minfo.ApparentEnclosingType
// prohibit calls to methods that are declared in specific array types (Get,Set,Address)
// these calls are provided by the runtime and should not be called from the user code
if isArrayTy g enclTy then
diff --git a/src/fsharp/MethodOverrides.fs b/src/fsharp/MethodOverrides.fs
index 44e8cf67447..fdaab282497 100644
--- a/src/fsharp/MethodOverrides.fs
+++ b/src/fsharp/MethodOverrides.fs
@@ -83,7 +83,7 @@ module DispatchSlotChecking =
let (CompiledSig (argTys,retTy,fmtps,ttpinst)) = CompiledSigOfMeth g amap m minfo
let isFakeEventProperty = minfo.IsFSharpEventPropertyMethod
- Override(parentType,tcrefOfAppTy g minfo.EnclosingType,mkSynId m nm, (fmtps,ttpinst),argTys,retTy,isFakeEventProperty,false)
+ Override(parentType, minfo.ApparentEnclosingTyconRef, mkSynId m nm, (fmtps,ttpinst),argTys,retTy,isFakeEventProperty,false)
/// Get the override info for a value being used to implement a dispatch slot.
let GetTypeMemberOverrideInfo g reqdTy (overrideBy:ValRef) =
@@ -121,7 +121,7 @@ module DispatchSlotChecking =
//CanImplementAnySlot <<----- Change to this to enable implicit interface implementation
let isFakeEventProperty = overrideBy.IsFSharpEventProperty(g)
- Override(implKind,overrideBy.MemberApparentParent, mkSynId overrideBy.Range nm, (memberMethodTypars,memberToParentInst),argTys,retTy,isFakeEventProperty, overrideBy.IsCompilerGenerated)
+ Override(implKind,overrideBy.MemberApparentEntity, mkSynId overrideBy.Range nm, (memberMethodTypars,memberToParentInst),argTys,retTy,isFakeEventProperty, overrideBy.IsCompilerGenerated)
/// Get the override information for an object expression method being used to implement dispatch slots
let GetObjectExprOverrideInfo g amap (implty, id:Ident, memberFlags, ty, arityInfo, bindingAttribs, rhsExpr) =
@@ -160,9 +160,8 @@ module DispatchSlotChecking =
(match overrideBy.CanImplement with
| CanImplementNoSlots -> false
| CanImplementAnySlot -> true
- | CanImplementAnyClassHierarchySlot -> not (isInterfaceTy g dispatchSlot.EnclosingType)
- //| CanImplementSpecificInterfaceSlot parentTy -> isInterfaceTy g dispatchSlot.EnclosingType && typeEquiv g parentTy dispatchSlot.EnclosingType
- | CanImplementAnyInterfaceSlot -> isInterfaceTy g dispatchSlot.EnclosingType)
+ | CanImplementAnyClassHierarchySlot -> not (isInterfaceTy g dispatchSlot.ApparentEnclosingType)
+ | CanImplementAnyInterfaceSlot -> isInterfaceTy g dispatchSlot.ApparentEnclosingType)
/// Check if the kinds of type parameters match between a dispatch slot and an override.
let IsTyparKindMatch g amap m (dispatchSlot:MethInfo) (Override(_,_,_,(mtps,_),_,_,_,_)) =
@@ -236,7 +235,7 @@ module DispatchSlotChecking =
let OverrideImplementsDispatchSlot g amap m dispatchSlot availPriorOverride =
IsExactMatch g amap m dispatchSlot availPriorOverride &&
// The override has to actually be in some subtype of the dispatch slot
- ExistsHeadTypeInEntireHierarchy g amap m (generalizedTyconRef availPriorOverride.BoundingTyconRef) (tcrefOfAppTy g dispatchSlot.EnclosingType)
+ ExistsHeadTypeInEntireHierarchy g amap m (generalizedTyconRef availPriorOverride.BoundingTyconRef) dispatchSlot.DeclaringTyconRef
/// Check if a dispatch slot is already implemented
let DispatchSlotIsAlreadyImplemented g amap m availPriorOverridesKeyed (dispatchSlot: MethInfo) =
@@ -363,11 +362,11 @@ module DispatchSlotChecking =
| [dispatchSlot] ->
- if dispatchSlot.IsFinal && (isObjExpr || not (typeEquiv g reqdTy dispatchSlot.EnclosingType)) then
+ if dispatchSlot.IsFinal && (isObjExpr || not (typeEquiv g reqdTy dispatchSlot.ApparentEnclosingType)) then
errorR(Error(FSComp.SR.typrelMethodIsSealed(NicePrint.stringOfMethInfo amap m denv dispatchSlot),m))
| dispatchSlots ->
match dispatchSlots |> List.filter (fun dispatchSlot ->
- isInterfaceTy g dispatchSlot.EnclosingType ||
+ isInterfaceTy g dispatchSlot.ApparentEnclosingType ||
not (DispatchSlotIsAlreadyImplemented g amap m availPriorOverridesKeyed dispatchSlot)) with
| h1 :: h2 :: _ ->
errorR(Error(FSComp.SR.typrelOverrideImplementsMoreThenOneSlot((FormatOverride denv overrideBy), (NicePrint.stringOfMethInfo amap m denv h1), (NicePrint.stringOfMethInfo amap m denv h2)),m))
@@ -375,7 +374,7 @@ module DispatchSlotChecking =
// dispatch slots are ordered from the derived classes to base
// so we can check the topmost dispatch slot if it is final
match dispatchSlots with
- | meth::_ when meth.IsFinal -> errorR(Error(FSComp.SR.tcCannotOverrideSealedMethod((sprintf "%s::%s" (meth.EnclosingType.ToString()) (meth.LogicalName))), m))
+ | meth::_ when meth.IsFinal -> errorR(Error(FSComp.SR.tcCannotOverrideSealedMethod((sprintf "%s::%s" (meth.ApparentEnclosingType.ToString()) (meth.LogicalName))), m))
| _ -> ()
@@ -452,6 +451,7 @@ module DispatchSlotChecking =
// Is a member an abstract slot of one of the implied interface types?
let isImpliedInterfaceType ty =
+ isAppTy g ty &&
isImpliedInterfaceTable.ContainsKey (tcrefOfAppTy g ty) &&
impliedTys |> List.exists (TypesFeasiblyEquiv 0 g amap reqdTyRange ty)
@@ -505,7 +505,7 @@ module DispatchSlotChecking =
// We also collect up the properties. This is used for abstract slot inference when overriding properties
let isRelevantRequiredProperty (x:PropInfo) =
(x.IsVirtualProperty && not (isInterfaceTy g reqdTy)) ||
- isImpliedInterfaceType x.EnclosingType
+ isImpliedInterfaceType x.ApparentEnclosingType
let reqdProperties =
GetIntrinsicPropInfosOfType infoReader (None,AccessibleFromSomewhere,AllowMultiIntfInstantiations.Yes) IgnoreOverrides reqdTyRange reqdTy
@@ -609,7 +609,7 @@ module DispatchSlotChecking =
let overridenForThisSlotImplSet =
[ for (RequiredSlot(dispatchSlot,_)) in NameMultiMap.find overrideByInfo.LogicalName dispatchSlotsKeyed do
if OverrideImplementsDispatchSlot g amap m dispatchSlot overrideByInfo then
- if tyconRefEq g overrideByInfo.BoundingTyconRef (tcrefOfAppTy g dispatchSlot.EnclosingType) then
+ if tyconRefEq g overrideByInfo.BoundingTyconRef dispatchSlot.DeclaringTyconRef then
match dispatchSlot.ArbitraryValRef with
| Some virtMember ->
if virtMember.MemberInfo.Value.IsImplemented then errorR(Error(FSComp.SR.tcDefaultImplementationAlreadyExists(),overrideByInfo.Range))
diff --git a/src/fsharp/NameResolution.fs b/src/fsharp/NameResolution.fs
index 87499989573..dcbc1f074ec 100644
--- a/src/fsharp/NameResolution.fs
+++ b/src/fsharp/NameResolution.fs
@@ -517,7 +517,7 @@ let AddValRefsToItems (bulkAddMode: BulkAdd) (eUnqualifiedItems: LayeredMap<_,_>
/// Add an F# value to the table of available extension members, if necessary, as an FSharp-style extension member
let AddValRefToExtensionMembers pri (eIndexedExtensionMembers: TyconRefMultiMap<_>) (vref:ValRef) =
if vref.IsMember && vref.IsExtensionMember then
- eIndexedExtensionMembers.Add (vref.MemberApparentParent, FSExtMem (vref,pri))
+ eIndexedExtensionMembers.Add (vref.MemberApparentEntity, FSExtMem (vref,pri))
else
eIndexedExtensionMembers
@@ -853,7 +853,8 @@ let AddDeclaredTyparsToNameEnv check nenv typars =
/// a fresh set of inference type variables for the type parameters of the union type.
let FreshenTycon (ncenv: NameResolver) m (tcref:TyconRef) =
let tinst = ncenv.InstantiationGenerator m (tcref.Typars m)
- TType_app(tcref,tinst)
+ let improvedTy = ncenv.g.decompileType tcref tinst
+ improvedTy
/// Convert a reference to a union case into a UnionCaseInfo that includes
/// a fresh set of inference type variables for the type parameters of the union type.
@@ -1299,7 +1300,7 @@ let (|EntityUse|_|) (item: Item) =
| Item.DelegateCtor(AbbrevOrAppTy tcref)
| Item.FakeInterfaceCtor(AbbrevOrAppTy tcref) -> Some tcref
| Item.CtorGroup(_, ctor::_) ->
- match ctor.EnclosingType with
+ match ctor.ApparentEnclosingType with
| AbbrevOrAppTy tcref -> Some tcref
| _ -> None
| _ -> None
@@ -1609,7 +1610,7 @@ let CheckAllTyparsInferrable amap m item =
| Item.Property(_,pinfos) ->
pinfos |> List.forall (fun pinfo ->
pinfo.IsExtensionMember ||
- let freeInDeclaringType = freeInType CollectTyparsNoCaching pinfo.EnclosingType
+ let freeInDeclaringType = freeInType CollectTyparsNoCaching pinfo.ApparentEnclosingType
let freeInArgsAndRetType =
accFreeInTypes CollectTyparsNoCaching (pinfo.GetParamTypes(amap,m))
(freeInType CollectTyparsNoCaching (pinfo.GetPropertyType(amap,m)))
@@ -1620,7 +1621,7 @@ let CheckAllTyparsInferrable amap m item =
minfos |> List.forall (fun minfo ->
minfo.IsExtensionMember ||
let fminst = minfo.FormalMethodInst
- let freeInDeclaringType = freeInType CollectTyparsNoCaching minfo.EnclosingType
+ let freeInDeclaringType = freeInType CollectTyparsNoCaching minfo.ApparentEnclosingType
let freeInArgsAndRetType =
List.foldBack (accFreeInTypes CollectTyparsNoCaching) (minfo.GetParamTypes(amap, m, fminst))
(accFreeInTypes CollectTyparsNoCaching (minfo.GetObjArgTypes(amap, m, fminst))
@@ -1859,11 +1860,12 @@ let private ResolveObjectConstructorPrim (ncenv:NameResolver) edenv resInfo m ad
then
[DefaultStructCtor(g,typ)]
else []
- if (isNil defaultStructCtorInfo && isNil ctorInfos) || not (isAppTy g typ) then
+ if (isNil defaultStructCtorInfo && isNil ctorInfos) || (not (isAppTy g typ) && not (isAnyTupleTy g typ)) then
raze (Error(FSComp.SR.nrNoConstructorsAvailableForType(NicePrint.minimalStringOfType edenv typ),m))
else
let ctorInfos = ctorInfos |> List.filter (IsMethInfoAccessible amap m ad)
- success (resInfo,Item.MakeCtorGroup ((tcrefOfAppTy g typ).LogicalName, (defaultStructCtorInfo@ctorInfos)))
+ let metadataTy = helpEnsureTypeHasMetadata g typ
+ success (resInfo,Item.MakeCtorGroup ((tcrefOfAppTy g metadataTy).LogicalName, (defaultStructCtorInfo@ctorInfos)))
/// Perform name resolution for an identifier which must resolve to be an object constructor.
let ResolveObjectConstructor (ncenv:NameResolver) edenv m ad typ =
@@ -1906,7 +1908,7 @@ let ExtensionPropInfosOfTypeInScope (infoReader:InfoReader) (nenv: NameResolutio
let extMemsFromHierarchy =
infoReader.GetEntireTypeHierachy(AllowMultiIntfInstantiations.Yes,m,typ) |> List.collect (fun typ ->
- if (isAppTy g typ) then
+ if isAppTy g typ then
let tcref = tcrefOfAppTy g typ
let extMemInfos = nenv.eIndexedExtensionMembers.Find tcref
SelectPropInfosFromExtMembers (infoReader,ad,optFilter) typ m extMemInfos
@@ -1969,7 +1971,7 @@ let ExtensionMethInfosOfTypeInScope (infoReader:InfoReader) (nenv: NameResolutio
let extMemsFromHierarchy =
infoReader.GetEntireTypeHierachy(AllowMultiIntfInstantiations.Yes,m,typ) |> List.collect (fun typ ->
let g = infoReader.g
- if (isAppTy g typ) then
+ if isAppTy g typ then
let tcref = tcrefOfAppTy g typ
let extValRefs = nenv.eIndexedExtensionMembers.Find tcref
SelectMethInfosFromExtMembers infoReader optFilter typ m extValRefs
@@ -2010,7 +2012,7 @@ let CoreDisplayName(pinfo:PropInfo) =
| FSProp(_,_,_,Some set) -> set.CoreDisplayName
| FSProp(_,_,Some get,_) -> get.CoreDisplayName
| FSProp _ -> failwith "unexpected (property must have either getter or setter)"
- | ILProp(_,ILPropInfo(_,def)) -> def.Name
+ | ILProp(ILPropInfo(_,def)) -> def.Name
#if !NO_EXTENSIONTYPING
| ProvidedProp(_,pi,m) -> pi.PUntaint((fun pi -> pi.Name), m)
#endif
@@ -2019,8 +2021,8 @@ let DecodeFSharpEvent (pinfos:PropInfo list) ad g (ncenv:NameResolver) m =
match pinfos with
| [pinfo] when pinfo.IsFSharpEventProperty ->
let nm = CoreDisplayName(pinfo)
- let minfos1 = GetImmediateIntrinsicMethInfosOfType (Some("add_"+nm),ad) g ncenv.amap m pinfo.EnclosingType
- let minfos2 = GetImmediateIntrinsicMethInfosOfType (Some("remove_"+nm),ad) g ncenv.amap m pinfo.EnclosingType
+ let minfos1 = GetImmediateIntrinsicMethInfosOfType (Some("add_"+nm),ad) g ncenv.amap m pinfo.ApparentEnclosingType
+ let minfos2 = GetImmediateIntrinsicMethInfosOfType (Some("remove_"+nm),ad) g ncenv.amap m pinfo.ApparentEnclosingType
match minfos1,minfos2 with
| [FSMeth(_,_,addValRef,_)],[FSMeth(_,_,removeValRef,_)] ->
// FOUND PROPERTY-AS-EVENT AND CORRESPONDING ADD/REMOVE METHODS
@@ -2246,7 +2248,7 @@ let rec ResolveExprLongIdentInModuleOrNamespace (ncenv:NameResolver) nenv (typeN
match typeNameResInfo.ResolutionFlag with
| ResolveTypeNamesToTypeRefs ->
success [ for (resInfo,tcref) in tcrefs do
- let typ = FreshenTycon ncenv m tcref
+ let typ = FreshenTycon ncenv m tcref
let item = (resInfo,Item.Types(id.idText,[typ]),[])
yield item ]
| ResolveTypeNamesToCtors ->
@@ -3483,6 +3485,7 @@ let ResolveCompletionsInType (ncenv: NameResolver) nenv (completionTargets: Reso
not x.IsSpecialName &&
x.IsStatic = statics &&
IsILFieldInfoAccessible g amap m ad x)
+
let pinfosIncludingUnseen =
AllPropInfosOfTypeInScope ncenv.InfoReader nenv (None,ad) PreferOverrides m typ
|> List.filter (fun x ->
@@ -3506,8 +3509,8 @@ let ResolveCompletionsInType (ncenv: NameResolver) nenv (completionTargets: Reso
let (SigOfFunctionForDelegate(invokeMethInfo,_,_,_)) = GetSigOfFunctionForDelegate ncenv.InfoReader delegateType m ad
// Only events with void return types are suppressed in intellisense.
if slotSigHasVoidReturnTy (invokeMethInfo.GetSlotSig(amap, m)) then
- yield einfo.GetAddMethod().DisplayName
- yield einfo.GetRemoveMethod().DisplayName ]
+ yield einfo.AddMethod.DisplayName
+ yield einfo.RemoveMethod.DisplayName ]
else []
let suppressedMethNames = Zset.ofList String.order (pinfoMethNames @ einfoMethNames)
@@ -3521,6 +3524,7 @@ let ResolveCompletionsInType (ncenv: NameResolver) nenv (completionTargets: Reso
match completionTargets with
| ResolveCompletionTargets.All x -> x
| _ -> failwith "internal error: expected completionTargets = ResolveCompletionTargets.All"
+
// Only show the Finalize, MemberwiseClose etc. methods on System.Object for values whose static type really is
// System.Object. Few of these are typically used from F#.
//
@@ -3530,10 +3534,10 @@ let ResolveCompletionsInType (ncenv: NameResolver) nenv (completionTargets: Reso
not minfo.IsExtensionMember &&
match minfo.LogicalName with
| "GetType" -> false
- | "GetHashCode" -> isObjTy g minfo.EnclosingType && not (AugmentWithHashCompare.TypeDefinitelyHasEquality g typ)
+ | "GetHashCode" -> isObjTy g minfo.ApparentEnclosingType && not (AugmentWithHashCompare.TypeDefinitelyHasEquality g typ)
| "ToString" -> false
| "Equals" ->
- if not (isObjTy g minfo.EnclosingType) then
+ if not (isObjTy g minfo.ApparentEnclosingType) then
// declaring type is not System.Object - show it
false
elif minfo.IsInstance then
@@ -3544,7 +3548,8 @@ let ResolveCompletionsInType (ncenv: NameResolver) nenv (completionTargets: Reso
true
| _ ->
// filter out self methods of obj type
- isObjTy g minfo.EnclosingType
+ isObjTy g minfo.ApparentEnclosingType
+
let result =
not isUnseenDueToBasicObjRules &&
not minfo.IsInstance = statics &&
@@ -3556,6 +3561,7 @@ let ResolveCompletionsInType (ncenv: NameResolver) nenv (completionTargets: Reso
not (minfo.LogicalName = ".ctor") &&
isApplicableMeth minfo typ &&
not (suppressedMethNames.Contains minfo.LogicalName)
+
result
let pinfoItems =
@@ -4143,8 +4149,8 @@ let ResolveCompletionsInTypeForItem (ncenv: NameResolver) nenv m ad statics typ
let (SigOfFunctionForDelegate(invokeMethInfo,_,_,_)) = GetSigOfFunctionForDelegate ncenv.InfoReader delegateType m ad
// Only events with void return types are suppressed in intellisense.
if slotSigHasVoidReturnTy (invokeMethInfo.GetSlotSig(amap, m)) then
- yield einfo.GetAddMethod().DisplayName
- yield einfo.GetRemoveMethod().DisplayName ]
+ yield einfo.AddMethod.DisplayName
+ yield einfo.RemoveMethod.DisplayName ]
let suppressedMethNames = Zset.ofList String.order (pinfoMethNames @ einfoMethNames)
@@ -4162,10 +4168,10 @@ let ResolveCompletionsInTypeForItem (ncenv: NameResolver) nenv m ad statics typ
not minfo.IsExtensionMember &&
match minfo.LogicalName with
| "GetType" -> false
- | "GetHashCode" -> isObjTy g minfo.EnclosingType && not (AugmentWithHashCompare.TypeDefinitelyHasEquality g typ)
+ | "GetHashCode" -> isObjTy g minfo.ApparentEnclosingType && not (AugmentWithHashCompare.TypeDefinitelyHasEquality g typ)
| "ToString" -> false
| "Equals" ->
- if not (isObjTy g minfo.EnclosingType) then
+ if not (isObjTy g minfo.ApparentEnclosingType) then
// declaring type is not System.Object - show it
false
elif minfo.IsInstance then
@@ -4176,7 +4182,7 @@ let ResolveCompletionsInTypeForItem (ncenv: NameResolver) nenv m ad statics typ
true
| _ ->
// filter out self methods of obj type
- isObjTy g minfo.EnclosingType
+ isObjTy g minfo.ApparentEnclosingType
let result =
not isUnseenDueToBasicObjRules &&
not minfo.IsInstance = statics &&
diff --git a/src/fsharp/NicePrint.fs b/src/fsharp/NicePrint.fs
index c5a8b19ef99..85415c05901 100755
--- a/src/fsharp/NicePrint.fs
+++ b/src/fsharp/NicePrint.fs
@@ -659,11 +659,11 @@ module private PrintTypes =
match k with
| ILAttrib ilMethRef ->
let trimmedName =
- let name = ilMethRef.EnclosingTypeRef.Name
+ let name = ilMethRef.DeclaringTypeRef.Name
match String.tryDropSuffix name "Attribute" with
| Some shortName -> shortName
| None -> name
- let tref = ilMethRef.EnclosingTypeRef
+ let tref = ilMethRef.DeclaringTypeRef
let tref = ILTypeRef.Create(scope= tref.Scope, enclosing=tref.Enclosing, name=trimmedName)
PrintIL.layoutILTypeRef denv tref ++ argsL
| FSAttrib vref ->
@@ -1111,7 +1111,7 @@ module private PrintTastMemberOrVals =
DemangleOperatorNameAsLayout (tagFunction >> mkNav v.DefinitionRange) name
let nameL =
if denv.showMemberContainers then
- layoutTyconRef denv v.MemberApparentParent ^^ SepL.dot ^^ nameL
+ layoutTyconRef denv v.MemberApparentEntity ^^ SepL.dot ^^ nameL
else
nameL
let nameL = if denv.showTyparBinding then layoutTyparDecls denv nameL true niceMethodTypars else nameL
@@ -1296,18 +1296,15 @@ module InfoMemberPrinting =
// Container(argName1:argType1, ..., argNameN:argTypeN) : retType
// Container.Method(argName1:argType1, ..., argNameN:argTypeN) : retType
let private layoutMethInfoCSharpStyle amap m denv (minfo:MethInfo) minst =
- let retTy = if minfo.IsConstructor then minfo.EnclosingType else minfo.GetFSharpReturnTy(amap, m, minst)
+ let retTy = if minfo.IsConstructor then minfo.ApparentEnclosingType else minfo.GetFSharpReturnTy(amap, m, minst)
let layout =
if minfo.IsExtensionMember then
LeftL.leftParen ^^ wordL (tagKeyword (FSComp.SR.typeInfoExtension())) ^^ RightL.rightParen
else emptyL
let layout =
layout ^^
- match tryDestAppTy amap.g minfo.EnclosingType with
- | Some tcref ->
- PrintTypes.layoutTyconRef denv tcref
- | None ->
- PrintTypes.layoutType denv minfo.EnclosingType
+ let tcref = minfo.ApparentEnclosingTyconRef
+ PrintTypes.layoutTyconRef denv tcref
let layout =
layout ^^
if minfo.IsConstructor then
@@ -1357,9 +1354,9 @@ module InfoMemberPrinting =
// ApparentContainer.Method(argName1:argType1, ..., argNameN:argTypeN) : retType
let prettyLayoutOfMethInfoFreeStyle (amap: Import.ImportMap) m denv typarInst methInfo =
match methInfo with
- | DefaultStructCtor(g,_typ) ->
+ | DefaultStructCtor _ ->
let prettyTyparInst, _ = PrettyTypes.PrettifyInst amap.g typarInst
- prettyTyparInst, PrintTypes.layoutTyconRef denv (tcrefOfAppTy g methInfo.EnclosingType) ^^ wordL (tagPunctuation "()")
+ prettyTyparInst, PrintTypes.layoutTyconRef denv methInfo.ApparentEnclosingTyconRef ^^ wordL (tagPunctuation "()")
| FSMeth(_,_,vref,_) ->
let prettyTyparInst, resL = PrintTastMemberOrVals.prettyLayoutOfValOrMember { denv with showMemberContainers=true } typarInst vref.Deref
prettyTyparInst, resL
@@ -1383,7 +1380,7 @@ module InfoMemberPrinting =
| Some vref -> tagProperty >> mkNav vref.DefinitionRange
let nameL = DemangleOperatorNameAsLayout tagProp pinfo.PropertyName
wordL (tagText (FSComp.SR.typeInfoProperty())) ^^
- layoutTyconRef denv (tcrefOfAppTy g pinfo.EnclosingType) ^^
+ layoutTyconRef denv pinfo.ApparentEnclosingTyconRef ^^
SepL.dot ^^
nameL ^^
RightL.colon ^^
@@ -1404,7 +1401,7 @@ module private TastDefinitionPrinting =
open PrintTypes
let layoutExtensionMember denv (v:Val) =
- let tycon = v.MemberApparentParent.Deref
+ let tycon = v.MemberApparentEntity.Deref
let nameL = tagMethod tycon.DisplayName |> mkNav v.DefinitionRange |> wordL
let nameL = layoutAccessibility denv tycon.Accessibility nameL // "type-accessibility"
let tps =
@@ -1557,8 +1554,8 @@ module private TastDefinitionPrinting =
if p.HasGetter then yield p.GetterMethod.DisplayName
if p.HasSetter then yield p.SetterMethod.DisplayName
for e in events do
- yield e.GetAddMethod().DisplayName
- yield e.GetRemoveMethod().DisplayName ]
+ yield e.AddMethod.DisplayName
+ yield e.RemoveMethod.DisplayName ]
with _ -> Set.empty
let ctorLs =
diff --git a/src/fsharp/Optimizer.fs b/src/fsharp/Optimizer.fs
index b4ebba45671..88784272d39 100644
--- a/src/fsharp/Optimizer.fs
+++ b/src/fsharp/Optimizer.fs
@@ -1513,7 +1513,7 @@ let (|AnyRefTupleTrans|) e =
/// Look for any QueryBuilder.* operation and transform
let (|AnyQueryBuilderOpTrans|_|) g = function
| Expr.App((Expr.Val (vref, _, _) as v), vty, tyargs, [builder; AnyRefTupleTrans( (src::rest), replaceArgs) ], m) when
- (match vref.ApparentParent with Parent tcref -> tyconRefEq g tcref g.query_builder_tcref | ParentNone -> false) ->
+ (match vref.ApparentEnclosingEntity with Parent tcref -> tyconRefEq g tcref g.query_builder_tcref | ParentNone -> false) ->
Some (src, (fun newSource -> Expr.App(v, vty, tyargs, [builder; replaceArgs(newSource::rest)], m)))
| _ -> None
@@ -1814,9 +1814,9 @@ and OptimizeExprOp cenv env (op, tyargs, args, m) =
// guarantees to optimize.
| TOp.ILCall (_, _, _, _, _, _, _, mref, _enclTypeArgs, _methTypeArgs, _tys), _, [arg]
- when (mref.EnclosingTypeRef.Scope.IsAssemblyRef &&
- mref.EnclosingTypeRef.Scope.AssemblyRef.Name = cenv.g.ilg.typ_Array.TypeRef.Scope.AssemblyRef.Name &&
- mref.EnclosingTypeRef.Name = cenv.g.ilg.typ_Array.TypeRef.Name &&
+ when (mref.DeclaringTypeRef.Scope.IsAssemblyRef &&
+ mref.DeclaringTypeRef.Scope.AssemblyRef.Name = cenv.g.ilg.typ_Array.TypeRef.Scope.AssemblyRef.Name &&
+ mref.DeclaringTypeRef.Name = cenv.g.ilg.typ_Array.TypeRef.Name &&
mref.Name = "get_Length" &&
isArray1DTy cenv.g (tyOfExpr cenv.g arg)) ->
OptimizeExpr cenv env (Expr.Op(TOp.ILAsm(i_ldlen, [cenv.g.int_ty]), [], [arg], m))
@@ -2523,7 +2523,7 @@ and TryInlineApplication cenv env finfo (tyargs: TType list, args: Expr list, m)
else
match finfo.Info with
| ValValue(vref, _) ->
- match vref.ApparentParent with
+ match vref.ApparentEnclosingEntity with
| Parent(tcr) when (tyconRefEq cenv.g cenv.g.lazy_tcr_canon tcr) ->
match tcr.CompiledRepresentation with
| CompiledTypeRepr.ILAsmNamed(iltr, _, _) -> iltr.Scope.AssemblyRef.Name = "FSharp.Core"
@@ -2971,7 +2971,7 @@ and OptimizeBinding cenv isRec env (TBind(vref, expr, spBind)) =
(vref.InlineInfo = ValInline.Never) ||
// MarshalByRef methods may not be inlined
- (match vref.ActualParent with
+ (match vref.DeclaringEntity with
| Parent tcref ->
match cenv.g.system_MarshalByRefObject_tcref with
| None -> false
diff --git a/src/fsharp/PatternMatchCompilation.fs b/src/fsharp/PatternMatchCompilation.fs
index 7c42d19b7ce..a40292a3565 100644
--- a/src/fsharp/PatternMatchCompilation.fs
+++ b/src/fsharp/PatternMatchCompilation.fs
@@ -873,7 +873,7 @@ let CompilePatternBasic
let v,vexp = mkCompGenLocal m "typeTestResult" tgty
if topv.IsMemberOrModuleBinding then
- AdjustValToTopVal v topv.ActualParent ValReprInfo.emptyValData
+ AdjustValToTopVal v topv.DeclaringEntity ValReprInfo.emptyValData
let argexp = GetSubExprOfInput subexpr
let appexp = mkIsInst tgty argexp matchm
Some(vexp),Some(mkInvisibleBind v appexp)
@@ -888,7 +888,7 @@ let CompilePatternBasic
| None -> Some addrexp, None
| Some (v,e) ->
if topv.IsMemberOrModuleBinding then
- AdjustValToTopVal v topv.ActualParent ValReprInfo.emptyValData
+ AdjustValToTopVal v topv.DeclaringEntity ValReprInfo.emptyValData
Some addrexp, Some (mkInvisibleBind v e)
@@ -904,7 +904,7 @@ let CompilePatternBasic
let ucaseTy = (mkProvenUnionCaseTy g.cons_ucref tinst)
let v,vexp = mkCompGenLocal m "unionTestResult" ucaseTy
if topv.IsMemberOrModuleBinding then
- AdjustValToTopVal v topv.ActualParent ValReprInfo.emptyValData
+ AdjustValToTopVal v topv.DeclaringEntity ValReprInfo.emptyValData
let argexp = GetSubExprOfInput subexpr
let appexp = mkIsInst ucaseTy argexp matchm
Some vexp,Some (mkInvisibleBind v appexp)
@@ -917,7 +917,7 @@ let CompilePatternBasic
let rty = apinfo.ResultType g m resTys
let v,vexp = mkCompGenLocal m ("activePatternResult"^string (newUnique())) rty
if topv.IsMemberOrModuleBinding then
- AdjustValToTopVal v topv.ActualParent ValReprInfo.emptyValData
+ AdjustValToTopVal v topv.DeclaringEntity ValReprInfo.emptyValData
let argexp = GetSubExprOfInput subexpr
let appexp = mkApps g ((pexp,tyOfExpr g pexp), [], [argexp],m)
diff --git a/src/fsharp/PostInferenceChecks.fs b/src/fsharp/PostInferenceChecks.fs
index d0d2ef8da25..e999a80912a 100644
--- a/src/fsharp/PostInferenceChecks.fs
+++ b/src/fsharp/PostInferenceChecks.fs
@@ -540,7 +540,7 @@ and CheckExpr (cenv:cenv) (env:env) expr (context:ByrefContext) =
errorR(Error(FSComp.SR.chkLimitationsOfBaseKeyword(), m))
if (match vFlags with NormalValUse -> true | _ -> false) &&
v.IsConstructor &&
- (match v.ActualParent with Parent tcref -> isAbstractTycon tcref.Deref | _ -> false) then
+ (match v.DeclaringEntity with Parent tcref -> isAbstractTycon tcref.Deref | _ -> false) then
errorR(Error(FSComp.SR.tcAbstractTypeCannotBeInstantiated(),m))
if isByrefTy cenv.g v.Type &&
@@ -1157,7 +1157,7 @@ and CheckBinding cenv env alwaysCheckNoReraise (TBind(v,bindRhs,_) as bind) =
// Check accessibility
if (v.IsMemberOrModuleBinding || v.IsMember) && not v.IsIncrClassGeneratedMember then
- let access = AdjustAccess (IsHiddenVal env.sigToImplRemapInfo v) (fun () -> v.TopValActualParent.CompilationPath) v.Accessibility
+ let access = AdjustAccess (IsHiddenVal env.sigToImplRemapInfo v) (fun () -> v.TopValDeclaringEntity.CompilationPath) v.Accessibility
CheckTypeForAccess cenv env (fun () -> NicePrint.stringOfQualifiedValOrMember cenv.denv v) access v.Range v.Type
let env = if v.IsConstructor && not v.IsIncrClassConstructor then { env with limited=true } else env
@@ -1183,9 +1183,9 @@ and CheckBinding cenv env alwaysCheckNoReraise (TBind(v,bindRhs,_) as bind) =
// Also check the enclosing type for members - for historical reasons, in the TAST member values
// are stored in the entity that encloses the type, hence we will not have noticed the ReflectedDefinition
// on the enclosing type at this point.
- HasFSharpAttribute cenv.g cenv.g.attrib_ReflectedDefinitionAttribute v.TopValActualParent.Attribs) then
+ HasFSharpAttribute cenv.g cenv.g.attrib_ReflectedDefinitionAttribute v.TopValDeclaringEntity.Attribs) then
- if v.IsInstanceMember && v.MemberApparentParent.IsStructOrEnumTycon then
+ if v.IsInstanceMember && v.MemberApparentEntity.IsStructOrEnumTycon then
errorR(Error(FSComp.SR.chkNoReflectedDefinitionOnStructMember(),v.Range))
cenv.usesQuotations <- true
@@ -1264,10 +1264,10 @@ let CheckModuleBinding cenv env (TBind(v,e,_) as bind) =
// Skip explicit implementations of interface methods
if ValIsExplicitImpl cenv.g v then () else
- match v.ActualParent with
+ match v.DeclaringEntity with
| ParentNone -> () // this case can happen after error recovery from earlier error
| Parent _ ->
- let tcref = v.TopValActualParent
+ let tcref = v.TopValDeclaringEntity
let hasDefaultAugmentation =
tcref.IsUnionTycon &&
match TryFindFSharpAttribute cenv.g cenv.g.attrib_DefaultAugmentationAttribute tcref.Attribs with
@@ -1336,7 +1336,7 @@ let CheckModuleBinding cenv env (TBind(v,e,_) as bind) =
if v2.IsExtensionMember && not (valEq v v2) && v.CompiledName = v2.CompiledName then
let minfo1 = FSMeth(cenv.g, generalizedTyconRef tcref, mkLocalValRef v, Some 0UL)
let minfo2 = FSMeth(cenv.g, generalizedTyconRef tcref, mkLocalValRef v2, Some 0UL)
- if tyconRefEq cenv.g v.MemberApparentParent v2.MemberApparentParent &&
+ if tyconRefEq cenv.g v.MemberApparentEntity v2.MemberApparentEntity &&
MethInfosEquivByNameAndSig EraseAll true cenv.g cenv.amap v.Range minfo1 minfo2 then
errorR(Duplicate(kind,v.DisplayName,v.Range)))
diff --git a/src/fsharp/QuotationTranslator.fs b/src/fsharp/QuotationTranslator.fs
index 177d50063d6..7216a700158 100644
--- a/src/fsharp/QuotationTranslator.fs
+++ b/src/fsharp/QuotationTranslator.fs
@@ -130,7 +130,7 @@ let (|ModuleValueOrMemberUse|_|) g expr =
Some(vref,vFlags,f,fty,tyargs,actualArgs @ args)
| Expr.App(f,_fty,[],actualArgs,_) ->
loop f (actualArgs @ args)
- | (Expr.Val(vref,vFlags,_m) as f) when (match vref.ActualParent with ParentNone -> false | _ -> true) ->
+ | (Expr.Val(vref,vFlags,_m) as f) when (match vref.DeclaringEntity with ParentNone -> false | _ -> true) ->
let fty = tyOfExpr g f
Some(vref,vFlags,f,fty,[],args)
| _ ->
@@ -301,7 +301,7 @@ and private ConvExprCore cenv (env : QuotationTranslationEnv) (expr: Expr) : QP.
// We only count one argument block for these.
let callArgs = (objArgs::untupledCurriedArgs) |> List.concat
- let parentTyconR = ConvTyconRef cenv vref.TopValActualParent m
+ let parentTyconR = ConvTyconRef cenv vref.TopValDeclaringEntity m
let isNewObj = isNewObj || valUseFlags || isSelfInit
// The signature types are w.r.t. to the formal context
let envinner = BindFormalTypars env tps
@@ -453,7 +453,7 @@ and private ConvExprCore cenv (env : QuotationTranslationEnv) (expr: Expr) : QP.
| TOp.ILAsm([ I_stfld(_,_,fspec) | I_stsfld (_,fspec) ],_),enclTypeArgs,args ->
let tyargsR = ConvTypes cenv env m enclTypeArgs
- let parentTyconR = ConvILTypeRefUnadjusted cenv m fspec.EnclosingTypeRef
+ let parentTyconR = ConvILTypeRefUnadjusted cenv m fspec.DeclaringTypeRef
let argsR = ConvLValueArgs cenv env args
QP.mkFieldSet( (parentTyconR, fspec.Name),tyargsR, argsR)
@@ -528,7 +528,7 @@ and private ConvExprCore cenv (env : QuotationTranslationEnv) (expr: Expr) : QP.
| TOp.LValueOp(LSet,vref),[],[e] ->
// Sets of module values become property sets
- match vref.ActualParent with
+ match vref.DeclaringEntity with
| Parent tcref when IsCompiledAsStaticProperty cenv.g vref.Deref ->
let parentTyconR = ConvTyconRef cenv tcref m
let propName = vref.CompiledName
@@ -558,7 +558,7 @@ and private ConvExprCore cenv (env : QuotationTranslationEnv) (expr: Expr) : QP.
| _ -> wfail(Error(FSComp.SR.crefQuotationsCantContainDescendingForLoops(), m))
| TOp.ILCall(_,_,_,isNewObj,valUseFlags,isProp,_,ilMethRef,enclTypeArgs,methTypeArgs,_tys),[],callArgs ->
- let parentTyconR = ConvILTypeRefUnadjusted cenv m ilMethRef.EnclosingTypeRef
+ let parentTyconR = ConvILTypeRefUnadjusted cenv m ilMethRef.DeclaringTypeRef
let isNewObj = isNewObj || (match valUseFlags with CtorValUsedAsSuperInit | CtorValUsedAsSelfInit -> true | _ -> false)
let methArgTypesR = List.map (ConvILType cenv env m) ilMethRef.ArgTypes
let methRetTypeR = ConvILType cenv env m ilMethRef.ReturnType
@@ -598,7 +598,7 @@ and private ConvExprCore cenv (env : QuotationTranslationEnv) (expr: Expr) : QP.
and ConvLdfld cenv env m (fspec: ILFieldSpec) enclTypeArgs args =
let tyargsR = ConvTypes cenv env m enclTypeArgs
- let parentTyconR = ConvILTypeRefUnadjusted cenv m fspec.EnclosingTypeRef
+ let parentTyconR = ConvILTypeRefUnadjusted cenv m fspec.DeclaringTypeRef
let argsR = ConvLValueArgs cenv env args
QP.mkFieldGet( (parentTyconR, fspec.Name),tyargsR, argsR)
@@ -716,7 +716,7 @@ and ConvModuleValueApp cenv env m (vref:ValRef) tyargs (args: Expr list list) =
EmitDebugInfoIfNecessary cenv env m (ConvModuleValueAppCore cenv env m vref tyargs args)
and ConvModuleValueAppCore cenv env m (vref:ValRef) tyargs (args: Expr list list) =
- match vref.ActualParent with
+ match vref.DeclaringEntity with
| ParentNone -> failwith "ConvModuleValueApp"
| Parent(tcref) ->
let isProperty = IsCompiledAsStaticProperty cenv.g vref.Deref
@@ -747,7 +747,7 @@ and private ConvValRefCore holeOk cenv env m (vref:ValRef) tyargs =
QP.mkThisVar(ConvType cenv env m v.Type)
else
let vty = v.Type
- match v.ActualParent with
+ match v.DeclaringEntity with
| ParentNone ->
// References to local values are embedded by value
if not holeOk then wfail(Error(FSComp.SR.crefNoSetOfHole(),m))
@@ -1030,14 +1030,14 @@ let ConvExprPublic cenv env e =
let ConvMethodBase cenv env (methName, v:Val) =
let m = v.Range
- let parentTyconR = ConvTyconRef cenv v.TopValActualParent m
+ let parentTyconR = ConvTyconRef cenv v.TopValDeclaringEntity m
match v.MemberInfo with
| Some vspr when not v.IsExtensionMember ->
let vref = mkLocalValRef v
let tps,argInfos,retTy,_ = GetTypeOfMemberInMemberForm cenv.g vref
- let numEnclTypeArgs = vref.MemberApparentParent.TyparsNoRange.Length
+ let numEnclTypeArgs = vref.MemberApparentEntity.TyparsNoRange.Length
let argTys = argInfos |> List.concat |> List.map fst
let isNewObj = (vspr.MemberFlags.MemberKind = MemberKind.Constructor)
diff --git a/src/fsharp/TastOps.fs b/src/fsharp/TastOps.fs
index f8140121c85..75716383667 100644
--- a/src/fsharp/TastOps.fs
+++ b/src/fsharp/TastOps.fs
@@ -601,13 +601,32 @@ let mkCompiledTupleTyconRef (g:TcGlobals) isStruct n =
elif n = 8 then (if isStruct then g.struct_tuple8_tcr else g.ref_tuple8_tcr)
else failwithf "mkCompiledTupleTyconRef, n = %d" n
-let rec mkCompiledTupleTy g isStruct tys =
- let n = List.length tys
- if n < maxTuple then TType_app (mkCompiledTupleTyconRef g isStruct n, tys)
+/// Convert from F# tuple types to .NET tuple types
+let rec mkCompiledTupleTy g isStruct tupElemTys =
+ let n = List.length tupElemTys
+ if n < maxTuple then
+ TType_app (mkCompiledTupleTyconRef g isStruct n, tupElemTys)
else
- let tysA, tysB = List.splitAfter goodTupleFields tys
+ let tysA, tysB = List.splitAfter goodTupleFields tupElemTys
TType_app ((if isStruct then g.struct_tuple8_tcr else g.ref_tuple8_tcr), tysA@[mkCompiledTupleTy g isStruct tysB])
+/// Convert from F# tuple types to .NET tuple types, but only the outermost level
+let mkOuterCompiledTupleTy g isStruct tupElemTys =
+ let n = List.length tupElemTys
+ if n < maxTuple then
+ TType_app (mkCompiledTupleTyconRef g isStruct n, tupElemTys)
+ else
+ let tysA, tysB = List.splitAfter goodTupleFields tupElemTys
+ let tcref = (if isStruct then g.struct_tuple8_tcr else g.ref_tuple8_tcr)
+ // In the case of an 8-tuple we add the Tuple<_> marker. For other sizes we keep the type
+ // as a regular F# tuple type.
+ match tysB with
+ | [ tyB ] ->
+ let marker = TType_app (mkCompiledTupleTyconRef g isStruct 1, [tyB])
+ TType_app (tcref, tysA@[marker])
+ | _ ->
+ TType_app (tcref, tysA@[TType_tuple (TupInfo.Const isStruct, tysB)])
+
//---------------------------------------------------------------------------
// Remove inference equations and abbreviations from types
//---------------------------------------------------------------------------
@@ -768,8 +787,15 @@ let mkInstForAppTy g typ =
| AppTy g (tcref, tinst) -> mkTyconRefInst tcref tinst
| _ -> []
-let domainOfFunTy g ty = fst(destFunTy g ty)
-let rangeOfFunTy g ty = snd(destFunTy g ty)
+let domainOfFunTy g ty = fst (destFunTy g ty)
+let rangeOfFunTy g ty = snd (destFunTy g ty)
+
+let helpEnsureTypeHasMetadata g ty =
+ if isAnyTupleTy g ty then
+ let (tupInfo, tupElemTys) = destAnyTupleTy g ty
+ mkOuterCompiledTupleTy g (evalTupInfoIsStruct tupInfo) tupElemTys
+ else ty
+
//---------------------------------------------------------------------------
// Equivalence of types up to alpha-equivalence
@@ -2135,7 +2161,7 @@ let PartitionValTyparsForApparentEnclosingType g (v:Val) =
| None -> error(InternalError("PartitionValTypars: not a top value", v.Range))
| Some arities ->
let fullTypars, _ = destTopForallTy g arities v.Type
- let parent = v.MemberApparentParent
+ let parent = v.MemberApparentEntity
let parentTypars = parent.TyparsNoRange
let nparentTypars = parentTypars.Length
if nparentTypars <= fullTypars.Length then
@@ -2706,8 +2732,8 @@ let superOfTycon (g:TcGlobals) (tycon:Tycon) =
// AbsIL view of attributes (we read these from .NET binaries)
let isILAttribByName (tencl:string list, tname: string) (attr: ILAttribute) =
- (attr.Method.EnclosingType.TypeSpec.Name = tname) &&
- (attr.Method.EnclosingType.TypeSpec.Enclosing = tencl)
+ (attr.Method.DeclaringType.TypeSpec.Name = tname) &&
+ (attr.Method.DeclaringType.TypeSpec.Enclosing = tencl)
// AbsIL view of attributes (we read these from .NET binaries)
let isILAttrib (tref:ILTypeRef) (attr: ILAttribute) =
@@ -2727,7 +2753,7 @@ let TryDecodeILAttribute (g:TcGlobals) tref (attrs: ILAttributes) =
// This one is done by name to ensure the compiler doesn't take a dependency on dereferencing a type that only exists in .NET 3.5
let ILThingHasExtensionAttribute (attrs : ILAttributes) =
attrs.AsArray
- |> Array.exists (fun attr -> attr.Method.EnclosingType.TypeSpec.Name = "System.Runtime.CompilerServices.ExtensionAttribute")
+ |> Array.exists (fun attr -> attr.Method.DeclaringType.TypeSpec.Name = "System.Runtime.CompilerServices.ExtensionAttribute")
// F# view of attributes (these get converted to AbsIL attributes in ilxgen)
let IsMatchingFSharpAttribute g (AttribInfo(_, tcref)) (Attrib(tcref2, _, _, _, _, _, _)) = tyconRefEq g tcref tcref2
@@ -3521,7 +3547,7 @@ module DebugPrint = begin
(lvalopL lvop ^^ valRefL vr --- bracketL (commaListL (List.map atomL args))) |> wrap
| Expr.Op (TOp.ILCall (_isVirtCall, _isProtectedCall, _valu, _isNewObjCall, _valUseFlags, _isProperty, _noTailCall, ilMethRef, tinst, minst, _tys), tyargs, args, _) ->
let meth = ilMethRef.Name
- wordL(tagText "ILCall") ^^ aboveListL [wordL(tagText "meth ") --- wordL (tagText ilMethRef.EnclosingTypeRef.FullName) ^^ sepL(tagText ".") ^^ wordL (tagText meth);
+ wordL(tagText "ILCall") ^^ aboveListL [wordL(tagText "meth ") --- wordL (tagText ilMethRef.DeclaringTypeRef.FullName) ^^ sepL(tagText ".") ^^ wordL (tagText meth);
wordL(tagText "tinst ") --- listL typeL tinst;
wordL(tagText "minst ") --- listL typeL minst;
wordL(tagText "tyargs") --- listL typeL tyargs;
@@ -4610,7 +4636,7 @@ and remapValData g tmenv (d: ValData) =
let ty' = ty |> remapPossibleForallTy g tmenv
{ d with
val_type = ty';
- val_actual_parent = d.val_actual_parent |> remapParentRef tmenv;
+ val_declaring_entity = d.val_declaring_entity |> remapParentRef tmenv;
val_repr_info = d.val_repr_info |> Option.map (remapValReprInfo g tmenv);
val_member_info = d.val_member_info |> Option.map (remapMemberInfo g d.val_range topValInfo ty ty' tmenv);
val_attribs = d.val_attribs |> remapAttribs g tmenv }
@@ -4928,7 +4954,7 @@ and remapMemberInfo g m topValInfo ty ty' tmenv x =
let renaming, _ = mkTyparToTyparRenaming tpsOrig tps
let tmenv = { tmenv with tpinst = tmenv.tpinst @ renaming }
{ x with
- ApparentParent = x.ApparentParent |> remapTyconRef tmenv.tyconRefRemap ;
+ ApparentEnclosingEntity = x.ApparentEnclosingEntity |> remapTyconRef tmenv.tyconRefRemap ;
ImplementedSlotSigs = x.ImplementedSlotSigs |> List.map (remapSlotSig (remapAttribs g tmenv) tmenv);
}
@@ -6390,7 +6416,7 @@ let mkCompilationMappingAttrForQuotationResource (g:TcGlobals) (nm, tys: ILTypeR
//----------------------------------------------------------------------------
let isTypeProviderAssemblyAttr (cattr:ILAttribute) =
- cattr.Method.EnclosingType.BasicQualifiedName = typeof.FullName
+ cattr.Method.DeclaringType.BasicQualifiedName = typeof.FullName
let TryDecodeTypeProviderAssemblyAttr ilg (cattr:ILAttribute) =
if isTypeProviderAssemblyAttr cattr then
@@ -6970,7 +6996,7 @@ let etaExpandTypeLambda g m tps (tm, ty) =
let AdjustValToTopVal (tmp:Val) parent valData =
tmp.SetValReprInfo (Some valData);
- tmp.val_actual_parent <- parent;
+ tmp.val_declaring_entity <- parent;
tmp.SetIsMemberOrModuleBinding()
/// For match with only one non-failing target T0, the other targets, T1... failing (say, raise exception).
@@ -7139,7 +7165,7 @@ let XmlDocSigOfVal g path (v:Val) =
| MemberKind.PropertyGetSet
| MemberKind.PropertySet
| MemberKind.PropertyGet -> "P:", v.PropertyName
- let path = if v.HasTopValActualParent then prependPath path v.TopValActualParent.CompiledName else path
+ let path = if v.HasDeclaringEntity then prependPath path v.TopValDeclaringEntity.CompiledName else path
let parentTypars, methTypars =
match PartitionValTypars g v with
| Some(_, memberParentTypars, memberMethodTypars, _, _) -> memberParentTypars, memberMethodTypars
@@ -7401,10 +7427,10 @@ let isComInteropTy g ty =
let ValSpecIsCompiledAsInstance g (v:Val) =
match v.MemberInfo with
| Some(membInfo) ->
- // Note it doesn't matter if we pass 'v.TopValActualParent' or 'v.MemberApparentParent' here.
+ // Note it doesn't matter if we pass 'v.TopValDeclaringEntity' or 'v.MemberApparentEntity' here.
// These only differ if the value is an extension member, and in that case MemberIsCompiledAsInstance always returns
// false anyway
- MemberIsCompiledAsInstance g v.MemberApparentParent v.IsExtensionMember membInfo v.Attribs
+ MemberIsCompiledAsInstance g v.MemberApparentEntity v.IsExtensionMember membInfo v.Attribs
| _ -> false
let ValRefIsCompiledAsInstanceMember g (vref: ValRef) = ValSpecIsCompiledAsInstance g vref.Deref
@@ -7417,7 +7443,7 @@ let ValRefIsCompiledAsInstanceMember g (vref: ValRef) = ValSpecIsCompiledAsInsta
let GetMemberCallInfo g (vref:ValRef, vFlags) =
match vref.MemberInfo with
| Some(membInfo) when not vref.IsExtensionMember ->
- let numEnclTypeArgs = vref.MemberApparentParent.TyparsNoRange.Length
+ let numEnclTypeArgs = vref.MemberApparentEntity.TyparsNoRange.Length
let virtualCall =
(membInfo.MemberFlags.IsOverrideOrExplicitImpl ||
membInfo.MemberFlags.IsDispatchSlot) &&
diff --git a/src/fsharp/TastOps.fsi b/src/fsharp/TastOps.fsi
index fb1822f362c..aefe35c8edc 100755
--- a/src/fsharp/TastOps.fsi
+++ b/src/fsharp/TastOps.fsi
@@ -224,16 +224,36 @@ val mkArrayElemAddress : TcGlobals -> ILReadonly * bool * ILArrayShape * TType *
// Compiled view of tuples
//-------------------------------------------------------------------------
+/// The largest tuple before we start encoding, i.e. 7
val maxTuple : int
+
+/// The number of fields in the largest tuple before we start encoding, i.e. 7
val goodTupleFields : int
+
+/// Check if a TyconRef is for a .NET tuple type. Currently this includes Tuple`1 even though
+/// that' not really part of the target set of TyconRef used to represent F# tuples.
val isCompiledTupleTyconRef : TcGlobals -> TyconRef -> bool
+
+/// Get a TyconRef for a .NET tuple type
val mkCompiledTupleTyconRef : TcGlobals -> bool -> int -> TyconRef
+
+/// Convert from F# tuple types to .NET tuple types.
val mkCompiledTupleTy : TcGlobals -> bool -> TTypes -> TType
+
+/// Convert from F# tuple creation expression to .NET tuple creation expressions
val mkCompiledTuple : TcGlobals -> bool -> TTypes * Exprs * range -> TyconRef * TTypes * Exprs * range
+
+/// Make a TAST expression representing getting an item fromm a tuple
val mkGetTupleItemN : TcGlobals -> range -> int -> ILType -> bool -> Expr -> TType -> Expr
+/// Evaluate the TupInfo to work out if it is a struct or a ref. Currently this is very simple
+/// but TupInfo may later be used carry variables that infer structness.
val evalTupInfoIsStruct : TupInfo -> bool
+/// If it is a tuple type, ensure it's outermost type is a .NET tuple type, otherwise leave unchanged
+val helpEnsureTypeHasMetadata : TcGlobals -> TType -> TType
+
+
//-------------------------------------------------------------------------
// Take the address of an expression, or force it into a mutable local. Any allocated
// mutable local may need to be kept alive over a larger expression, hence we return
diff --git a/src/fsharp/TastPickle.fs b/src/fsharp/TastPickle.fs
index 18307ce1559..3eb3ea37a48 100755
--- a/src/fsharp/TastPickle.fs
+++ b/src/fsharp/TastPickle.fs
@@ -948,13 +948,13 @@ and u_ILCallSig = u_wrap (fun (a,b,c) -> {CallingConv=a; ArgTypes=b; ReturnType=
and u_ILTypeSpec st = let a,b = u_tup2 u_ILTypeRef u_ILTypes st in ILTypeSpec.Create(a,b)
-let p_ILMethodRef (x: ILMethodRef) st = p_tup6 p_ILTypeRef p_ILCallConv p_int p_string p_ILTypes p_ILType (x.EnclosingTypeRef,x.CallingConv,x.GenericArity,x.Name,x.ArgTypes,x.ReturnType) st
+let p_ILMethodRef (x: ILMethodRef) st = p_tup6 p_ILTypeRef p_ILCallConv p_int p_string p_ILTypes p_ILType (x.DeclaringTypeRef,x.CallingConv,x.GenericArity,x.Name,x.ArgTypes,x.ReturnType) st
-let p_ILFieldRef (x: ILFieldRef) st = p_tup3 p_ILTypeRef p_string p_ILType (x.EnclosingTypeRef, x.Name, x.Type) st
+let p_ILFieldRef (x: ILFieldRef) st = p_tup3 p_ILTypeRef p_string p_ILType (x.DeclaringTypeRef, x.Name, x.Type) st
-let p_ILMethodSpec (x: ILMethodSpec) st = p_tup3 p_ILMethodRef p_ILType p_ILTypes (x.MethodRef, x.EnclosingType, x.GenericArgs) st
+let p_ILMethodSpec (x: ILMethodSpec) st = p_tup3 p_ILMethodRef p_ILType p_ILTypes (x.MethodRef, x.DeclaringType, x.GenericArgs) st
-let p_ILFieldSpec (x : ILFieldSpec) st = p_tup2 p_ILFieldRef p_ILType (x.FieldRef, x.EnclosingType) st
+let p_ILFieldSpec (x : ILFieldSpec) st = p_tup2 p_ILFieldRef p_ILType (x.FieldRef, x.DeclaringType) st
let p_ILBasicType x st =
p_int (match x with
@@ -982,7 +982,7 @@ let u_ILMethodRef st =
let u_ILFieldRef st =
let x1,x2,x3 = u_tup3 u_ILTypeRef u_string u_ILType st
- {EnclosingTypeRef=x1;Name=x2;Type=x3}
+ {DeclaringTypeRef=x1;Name=x2;Type=x3}
let u_ILMethodSpec st =
let x1,x2,x3 = u_tup3 u_ILMethodRef u_ILType u_ILTypes st
@@ -990,7 +990,7 @@ let u_ILMethodSpec st =
let u_ILFieldSpec st =
let x1,x2 = u_tup2 u_ILFieldRef u_ILType st
- {FieldRef=x1;EnclosingType=x2}
+ {FieldRef=x1;DeclaringType=x2}
let u_ILBasicType st =
match u_int st with
@@ -1778,7 +1778,7 @@ and p_attrib_arg (AttribNamedArg(a,b,c,d)) st =
and p_member_info (x:ValMemberInfo) st =
p_tup4 (p_tcref "member_info") p_MemberFlags (p_list p_slotsig) p_bool
- (x.ApparentParent,x.MemberFlags,x.ImplementedSlotSigs,x.IsImplemented) st
+ (x.ApparentEnclosingEntity,x.MemberFlags,x.ImplementedSlotSigs,x.IsImplemented) st
and p_tycon_objmodel_kind x st =
match x with
@@ -1822,7 +1822,7 @@ and p_ValData x st =
p_option p_ValReprInfo x.val_repr_info st
p_string x.val_xmldocsig st
p_access x.val_access st
- p_parentref x.val_actual_parent st
+ p_parentref x.val_declaring_entity st
p_option p_const x.val_const st
if st.oInMem then
p_used_space1 (p_xmldoc x.val_xmldoc) st
@@ -2063,7 +2063,7 @@ and u_attrib_arg st =
and u_member_info st : ValMemberInfo =
let x2,x3,x4,x5 = u_tup4 u_tcref u_MemberFlags (u_list u_slotsig) u_bool st
- { ApparentParent=x2
+ { ApparentEnclosingEntity=x2
MemberFlags=x3
ImplementedSlotSigs=x4
IsImplemented=x5 }
@@ -2134,7 +2134,7 @@ and u_ValData st =
val_xmldoc= defaultArg x15 XmlDoc.Empty
val_xmldocsig=x12
val_access=x13
- val_actual_parent=x13b
+ val_declaring_entity=x13b
val_const=x14
}
diff --git a/src/fsharp/TcGlobals.fs b/src/fsharp/TcGlobals.fs
index 210dc16f2cd..32bb8af8389 100755
--- a/src/fsharp/TcGlobals.fs
+++ b/src/fsharp/TcGlobals.fs
@@ -476,17 +476,29 @@ type public TcGlobals(compilingFslib: bool, ilg:ILGlobals, fslibCcu: CcuThunk, d
yield nleref.LastItemMangledName, ERefNonLocal nleref ]
- let decodeTupleTy tupInfo l =
+ let tryDecodeTupleTy tupInfo l =
match l with
| [t1;t2;t3;t4;t5;t6;t7;marker] ->
match marker with
- | TType_app(tcref, [t8]) when tyconRefEq tcref v_ref_tuple1_tcr -> mkRawRefTupleTy [t1;t2;t3;t4;t5;t6;t7;t8]
- | TType_app(tcref, [t8]) when tyconRefEq tcref v_struct_tuple1_tcr -> mkRawStructTupleTy [t1;t2;t3;t4;t5;t6;t7;t8]
- | TType_tuple (_structness2, t8plus) -> TType_tuple (tupInfo, [t1;t2;t3;t4;t5;t6;t7] @ t8plus)
- | _ -> TType_tuple (tupInfo, l)
- | _ -> TType_tuple (tupInfo, l)
+ | TType_app(tcref, [t8]) when tyconRefEq tcref v_ref_tuple1_tcr -> mkRawRefTupleTy [t1;t2;t3;t4;t5;t6;t7;t8] |> Some
+ | TType_app(tcref, [t8]) when tyconRefEq tcref v_struct_tuple1_tcr -> mkRawStructTupleTy [t1;t2;t3;t4;t5;t6;t7;t8] |> Some
+ | TType_tuple (_structness2, t8plus) -> TType_tuple (tupInfo, [t1;t2;t3;t4;t5;t6;t7] @ t8plus) |> Some
+ | _ -> None
+ | [] -> None
+ | [_] -> None
+ | _ -> TType_tuple (tupInfo, l) |> Some
+ let decodeTupleTy tupInfo l =
+ match tryDecodeTupleTy tupInfo l with
+ | Some ty -> ty
+ | None -> failwith "couldn't decode tuple ty"
+
+ let decodeTupleTyIfPossible tcref tupInfo l =
+ match tryDecodeTupleTy tupInfo l with
+ | Some ty -> ty
+ | None -> TType_app(tcref, l)
+
let mk_MFCore_attrib nm : BuiltinAttribInfo =
AttribInfo(mkILTyRef(IlxSettings.ilxFsharpCoreLibScopeRef (), FSharpLib.Core + "." + nm), mk_MFCore_tcref fslibCcu nm)
@@ -728,7 +740,7 @@ type public TcGlobals(compilingFslib: bool, ilg:ILGlobals, fslibCcu: CcuThunk, d
let addFieldNeverAttrs (fdef:ILFieldDef) = {fdef with CustomAttrs = addNeverAttrs fdef.CustomAttrs}
let mkDebuggerTypeProxyAttribute (ty : ILType) = mkILCustomAttribute ilg (findSysILTypeRef tname_DebuggerTypeProxyAttribute, [ilg.typ_Type], [ILAttribElem.TypeRef (Some ty.TypeRef)], [])
- let entries1 =
+ let betterTyconEntries =
[| "Int32" , v_int_tcr
"IntPtr" , v_nativeint_tcr
"UIntPtr" , v_unativeint_tcr
@@ -751,7 +763,7 @@ type public TcGlobals(compilingFslib: bool, ilg:ILGlobals, fslibCcu: CcuThunk, d
let ty = mkNonGenericTy tcr
nm, findSysTyconRef sys nm, (fun _ -> ty))
- let entries2 =
+ let decompileTyconEntries =
[|
"FSharpFunc`2" , v_fastFunc_tcr , (fun tinst -> mkFunTy (List.item 0 tinst) (List.item 1 tinst))
"Tuple`2" , v_ref_tuple2_tcr , decodeTupleTy tupInfoRef
@@ -760,62 +772,90 @@ type public TcGlobals(compilingFslib: bool, ilg:ILGlobals, fslibCcu: CcuThunk, d
"Tuple`5" , v_ref_tuple5_tcr , decodeTupleTy tupInfoRef
"Tuple`6" , v_ref_tuple6_tcr , decodeTupleTy tupInfoRef
"Tuple`7" , v_ref_tuple7_tcr , decodeTupleTy tupInfoRef
- "Tuple`8" , v_ref_tuple8_tcr , decodeTupleTy tupInfoRef
+ "Tuple`8" , v_ref_tuple8_tcr , decodeTupleTyIfPossible v_ref_tuple8_tcr tupInfoRef
"ValueTuple`2" , v_struct_tuple2_tcr , decodeTupleTy tupInfoStruct
"ValueTuple`3" , v_struct_tuple3_tcr , decodeTupleTy tupInfoStruct
"ValueTuple`4" , v_struct_tuple4_tcr , decodeTupleTy tupInfoStruct
"ValueTuple`5" , v_struct_tuple5_tcr , decodeTupleTy tupInfoStruct
"ValueTuple`6" , v_struct_tuple6_tcr , decodeTupleTy tupInfoStruct
"ValueTuple`7" , v_struct_tuple7_tcr , decodeTupleTy tupInfoStruct
- "ValueTuple`8" , v_struct_tuple8_tcr , decodeTupleTy tupInfoStruct |]
-
- // Build a map that uses the "canonical" F# type names and TyconRef's for these
- // in preference to the .NET type names. Doing this normalization is a fairly performance critical
- // piece of code as it is frequently invoked in the process of converting .NET metadata to F# internal
- // compiler data structures (see import.fs).
- let buildTyconMapper (entries: (string * TyconRef * _)[]) =
+ "ValueTuple`8" , v_struct_tuple8_tcr , decodeTupleTyIfPossible v_struct_tuple8_tcr tupInfoStruct |]
+
+ let betterEntries = Array.append betterTyconEntries decompileTyconEntries
+
+ let mutable decompileTypeDict = null
+ let mutable betterTypeDict1 = null
+ let mutable betterTypeDict2 = null
+
+ /// This map is indexed by stamps and lazy to avoid dereferencing while setting up the base imports.
+ let getDecompileTypeDict () =
+ match decompileTypeDict with
+ | null ->
+ let entries = decompileTyconEntries
+ let t = Dictionary.newWithSize entries.Length
+ for _, tcref, builder in entries do
+ if tcref.CanDeref then
+ t.Add(tcref.Stamp, builder)
+ decompileTypeDict <- t
+ t
+ | t -> t
+
+ /// This map is for use when building FSharp.Core.dll. The backing Tycon's may not yet exist for
+ /// the TyconRef's we have in our hands, hence we can't dereference them to find their stamps.
+ /// So this dictionary is indexed by names. Make it lazy to avoid dereferencing while setting up the base imports.
+ let getBetterTypeDict1 () =
+ match betterTypeDict1 with
+ | null ->
+ let entries = betterEntries
+ let t = Dictionary.newWithSize entries.Length
+ for nm, tcref, builder in entries do
+ t.Add(nm, fun tcref2 tinst2 -> if tyconRefEq tcref tcref2 then builder tinst2 else TType_app (tcref2, tinst2))
+ betterTypeDict1 <- t
+ t
+ | t -> t
+
+ /// This map is for use in normal times (not building FSharp.Core.dll). It is indexed by stamps
+ /// and lazy to avoid dereferencing while setting up the base imports.
+ let getBetterTypeDict2 () =
+ match betterTypeDict2 with
+ | null ->
+ let entries = betterEntries
+ let t = Dictionary.newWithSize entries.Length
+ for _, tcref, builder in entries do
+ if tcref.CanDeref then
+ t.Add(tcref.Stamp, builder)
+ betterTypeDict2 <- t
+ t
+ | t -> t
+
+ /// For logical purposes equate some F# types with .NET types, e.g. TType_tuple == System.Tuple/ValueTuple.
+ /// Doing this normalization is a fairly performance critical piece of code as it is frequently invoked
+ /// in the process of converting .NET metadata to F# internal compiler data structures (see import.fs).
+ let decompileTy (tcref: EntityRef) tinst =
+ if compilingFslib then
+ // No need to decompile when compiling FSharp.Core.dll
+ TType_app (tcref, tinst)
+ else
+ let dict = getDecompileTypeDict()
+ let mutable builder = Unchecked.defaultof<_>
+ if dict.TryGetValue(tcref.Stamp, &builder) then builder tinst
+ else TType_app (tcref, tinst)
+
+ /// For cosmetic purposes "improve" some .NET types, e.g. Int32 --> int32.
+ /// Doing this normalization is a fairly performance critical piece of code as it is frequently invoked
+ /// in the process of converting .NET metadata to F# internal compiler data structures (see import.fs).
+ let improveTy (tcref: EntityRef) tinst =
if compilingFslib then
- // This map is for use when building FSharp.Core.dll. The backing Tycon's may not yet exist for
- // the TyconRef's we have in our hands, hence we can't dereference them to find their stamps.
-
- // So this dictionary is indexed by names.
- //
- // Make it lazy to avoid dereferencing while setting up the base imports.
- let dict =
- lazy (
- let dict = Dictionary.newWithSize entries.Length
- for nm, tcref, builder in entries do
- dict.Add(nm, fun tcref2 tinst -> if tyconRefEq tcref tcref2 then Some(builder tinst) else None)
- dict
- )
- (fun (tcref: EntityRef) tinst ->
- let dict = dict.Value
- let key = tcref.LogicalName
- if dict.ContainsKey key then dict.[key] tcref tinst
- else None )
+ let dict = getBetterTypeDict1()
+ let mutable builder = Unchecked.defaultof<_>
+ if dict.TryGetValue(tcref.LogicalName, &builder) then builder tcref tinst
+ else TType_app (tcref, tinst)
else
- // This map is for use in normal times (not building FSharp.Core.dll). It is indexed by tcref stamp which is
- // faster than the indexing technique used in the case above.
- //
- // So this dictionary is indexed by integers.
- //
- // Make it lazy to avoid dereferencing while setting up the base imports.
- let dict =
- lazy
- let dict = Dictionary.newWithSize entries.Length
- for _, tcref, builder in entries do
- if tcref.CanDeref then
- dict.Add(tcref.Stamp, builder)
- dict
- (fun tcref2 tinst ->
- let dict = dict.Value
- let key = tcref2.Stamp
- if dict.ContainsKey key then Some(dict.[key] tinst)
- else None)
-
- let betterTyconRefMapper = buildTyconMapper (Array.append entries1 entries2)
-
- let decodeTyconRefMapper = buildTyconMapper entries2
+ let dict = getBetterTypeDict2()
+ let mutable builder = Unchecked.defaultof<_>
+ if dict.TryGetValue(tcref.Stamp, &builder) then builder tinst
+ else TType_app (tcref, tinst)
+
override x.ToString() = ""
member __.ilg=ilg
@@ -1106,8 +1146,10 @@ type public TcGlobals(compilingFslib: bool, ilg:ILGlobals, fslibCcu: CcuThunk, d
member val attrib_SecuritySafeCriticalAttribute = findSysAttrib "System.Security.SecuritySafeCriticalAttribute"
member val attrib_ComponentModelEditorBrowsableAttribute = findSysAttrib "System.ComponentModel.EditorBrowsableAttribute"
- member __.betterTyconRefMap = betterTyconRefMapper
- member __.decodeTyconRefMap = decodeTyconRefMapper
+ member g.improveType tcref tinst = improveTy tcref tinst
+
+ member g.decompileType tcref tinst = decompileTy tcref tinst
+
member __.new_decimal_info = v_new_decimal_info
member __.seq_info = v_seq_info
member val seq_vref = (ValRefForIntrinsic v_seq_info)
diff --git a/src/fsharp/TypeChecker.fs b/src/fsharp/TypeChecker.fs
index 061acc58c79..e21dcc9c45b 100755
--- a/src/fsharp/TypeChecker.fs
+++ b/src/fsharp/TypeChecker.fs
@@ -173,6 +173,10 @@ let MethInfoChecks g amap isInstance tyargsOpt objArgs ad m (minfo:MethInfo) =
if not (IsTypeAndMethInfoAccessible amap m adOriginal ad minfo) then
error (Error (FSComp.SR.tcMethodNotAccessible(minfo.LogicalName), m))
+
+ if isAnyTupleTy g minfo.ApparentEnclosingType then
+ warning (Error (FSComp.SR.tcTupleMemberNotNormallyUsed(), m))
+
CheckMethInfoAttributes g m tyargsOpt minfo |> CommitOperationResult
@@ -640,7 +644,7 @@ let MakeInnerEnvForTyconRef _cenv env tcref isExtrinsicExtension =
let MakeInnerEnvForMember cenv env (v:Val) =
match v.MemberInfo with
| None -> env
- | Some _ -> MakeInnerEnvForTyconRef cenv env v.MemberApparentParent v.IsExtensionMember
+ | Some _ -> MakeInnerEnvForTyconRef cenv env v.MemberApparentEntity v.IsExtensionMember
let GetCurrAccumulatedModuleOrNamespaceType env = !(env.eModuleOrNamespaceTypeAccumulator)
let SetCurrAccumulatedModuleOrNamespaceType env x = env.eModuleOrNamespaceTypeAccumulator := x
@@ -789,15 +793,15 @@ let UnifyFunctionType extraInfo cenv denv mFunExpr ty =
| None -> error (FunctionExpected(denv, ty, mFunExpr))
let ReportImplicitlyIgnoredBoolExpression denv m ty expr =
- let checkExpr m exprOpt =
- match exprOpt with
+ let checkExpr m expr =
+ match expr with
| Expr.App(Expr.Val(vf, _, _), _, _, exprs, _) when vf.LogicalName = opNameEquals ->
match exprs with
| Expr.App(Expr.Val(propRef, _, _), _, _, Expr.Val(vf, _, _) :: _, _) :: _ ->
if propRef.IsPropertyGetterMethod then
let propertyName = propRef.PropertyName
let hasCorrespondingSetter =
- match propRef.ActualParent with
+ match propRef.DeclaringEntity with
| Parent entityRef ->
entityRef.MembersOfFSharpTyconSorted
|> List.exists (fun valRef -> valRef.IsPropertySetterMethod && valRef.PropertyName = propertyName)
@@ -817,17 +821,16 @@ let ReportImplicitlyIgnoredBoolExpression denv m ty expr =
| _ -> UnitTypeExpected (denv, ty, m)
match expr with
- | Some(Expr.Let(_, Expr.Sequential(_, inner, _, _, _), _, _))
- | Some(Expr.Sequential(_, inner, _, _, _)) ->
+ | Expr.Let(_, Expr.Sequential(_, inner, _, _, _), _, _)
+ | Expr.Sequential(_, inner, _, _, _) ->
let rec extractNext expr =
match expr with
| Expr.Sequential(_, inner, _, _, _) -> extractNext inner
| _ -> checkExpr expr.Range expr
extractNext inner
- | Some expr -> checkExpr m expr
- | _ -> UnitTypeExpected (denv, ty, m)
+ | expr -> checkExpr m expr
-let UnifyUnitType cenv denv m ty exprOpt =
+let UnifyUnitType cenv denv m ty expr =
if AddCxTypeEqualsTypeUndoIfFailed denv cenv.css m ty cenv.g.unit_ty then
true
else
@@ -839,7 +842,7 @@ let UnifyUnitType cenv denv m ty exprOpt =
if not (typeEquiv cenv.g cenv.g.bool_ty ty) then
warning (UnitTypeExpected (denv, ty, m))
else
- warning (ReportImplicitlyIgnoredBoolExpression denv m ty exprOpt)
+ warning (ReportImplicitlyIgnoredBoolExpression denv m ty expr)
false
//-------------------------------------------------------------------------
@@ -1042,7 +1045,7 @@ let MakeMemberDataAndMangledNameForMemberVal(g, tcref, isExtrinsic, attrs, optIm
let logicalName = ComputeLogicalName id memberFlags
let optIntfSlotTys = if optImplSlotTys |> List.forall (isInterfaceTy g) then optImplSlotTys else []
let memberInfo : ValMemberInfo =
- { ApparentParent=tcref
+ { ApparentEnclosingEntity=tcref
MemberFlags=memberFlags
IsImplemented=false
// NOTE: This value is initially only set for interface implementations and those overrides
@@ -1345,7 +1348,7 @@ let PublishValueDefn cenv env declKind (vspec:Val) =
// // Static initializers don't get published to the tcaug
// not (memberInfo.MemberFlags.MemberKind = MemberKind.ClassConstructor)) ->
- let tcaug = vspec.MemberApparentParent.TypeContents
+ let tcaug = vspec.MemberApparentEntity.TypeContents
let vref = mkLocalValRef vspec
tcaug.tcaug_adhoc <- NameMultiMap.add vspec.LogicalName vref tcaug.tcaug_adhoc
tcaug.tcaug_adhoc_list.Add (ValRefIsExplicitImpl cenv.g vref, vref)
@@ -1430,7 +1433,7 @@ let MakeAndPublishVal cenv env (altActualParent, inSig, declKind, vrec, (ValSche
// If it's an extrinsic extension member or not a member then use the containing module.
match memberInfoOpt with
| Some (ValMemberInfoTransient(memberInfo, _, _)) when not isExtrinsic ->
- if memberInfo.ApparentParent.IsModuleOrNamespace then
+ if memberInfo.ApparentEnclosingEntity.IsModuleOrNamespace then
errorR(InternalError(FSComp.SR.tcExpectModuleOrNamespaceParent(id.idText), m))
// Members of interface implementations have the accessibility of the interface
@@ -1443,7 +1446,7 @@ let MakeAndPublishVal cenv env (altActualParent, inSig, declKind, vrec, (ValSche
| _ -> None
else
None
- Parent(memberInfo.ApparentParent), vis
+ Parent(memberInfo.ApparentEnclosingEntity), vis
| _ -> altActualParent, None
let vis, _ = ComputeAccessAndCompPath env (Some declKind) id.idRange vis overrideVis actualParent
@@ -1951,7 +1954,7 @@ let FreshenAbstractSlot g amap m synTyparDecls absMethInfo =
// If the virtual method is a generic method then copy its type parameters
let typarsFromAbsSlot, typarInstFromAbsSlot, _ =
let ttps = absMethInfo.GetFormalTyparsOfDeclaringType m
- let ttinst = argsOfAppTy g absMethInfo.EnclosingType
+ let ttinst = argsOfAppTy g absMethInfo.ApparentEnclosingType
let rigid = if typarsFromAbsSlotAreRigid then TyparRigidity.Rigid else TyparRigidity.Flexible
ConstraintSolver.FreshenAndFixupTypars m rigid ttps ttinst fmtps
@@ -3090,7 +3093,7 @@ let BuildILFieldGet g amap m objExpr (finfo:ILFieldInfo) =
// The empty instantiation on the AbstractIL fspec is OK, since we make the correct fspec in IlxGen.GenAsm
// This ensures we always get the type instantiation right when doing this from
// polymorphic code, after inlining etc. *
- let fspec = mkILFieldSpec(fref, mkILNamedTy valu fref.EnclosingTypeRef [])
+ let fspec = mkILFieldSpec(fref, mkILNamedTy valu fref.DeclaringTypeRef [])
// Add an I_nop if this is an initonly field to make sure we never recognize it as an lvalue. See mkExprAddrOfExpr.
wrap (mkAsmExpr (([ mkNormalLdfld fspec ] @ (if finfo.IsInitOnly then [ AI_nop ] else [])), tinst, [objExpr], [fieldType], m))
@@ -3102,7 +3105,7 @@ let BuildILFieldSet g m objExpr (finfo:ILFieldInfo) argExpr =
// The empty instantiation on the AbstractIL fspec is OK, since we make the correct fspec in IlxGen.GenAsm
// This ensures we always get the type instantiation right when doing this from
// polymorphic code, after inlining etc. *
- let fspec = mkILFieldSpec(fref, mkILNamedTy valu fref.EnclosingTypeRef [])
+ let fspec = mkILFieldSpec(fref, mkILNamedTy valu fref.DeclaringTypeRef [])
if finfo.IsInitOnly then error (Error (FSComp.SR.tcFieldIsReadonly(), m))
let wrap, objExpr = mkExprAddrOfExpr g isValueType false DefinitelyMutates objExpr None m
wrap (mkAsmExpr ([ mkNormalStfld fspec ], tinst, [objExpr; argExpr], [], m))
@@ -3115,12 +3118,12 @@ let BuildILStaticFieldSet m (finfo:ILFieldInfo) argExpr =
// The empty instantiation on the AbstractIL fspec is OK, since we make the correct fspec in IlxGen.GenAsm
// This ensures we always get the type instantiation right when doing this from
// polymorphic code, after inlining etc.
- let fspec = mkILFieldSpec(fref, mkILNamedTy valu fref.EnclosingTypeRef [])
+ let fspec = mkILFieldSpec(fref, mkILNamedTy valu fref.DeclaringTypeRef [])
if finfo.IsInitOnly then error (Error (FSComp.SR.tcFieldIsReadonly(), m))
mkAsmExpr ([ mkNormalStsfld fspec ], tinst, [argExpr], [], m)
let BuildRecdFieldSet g m objExpr (rfinfo:RecdFieldInfo) argExpr =
- let tgty = rfinfo.EnclosingType
+ let tgty = rfinfo.DeclaringType
let valu = isStructTy g tgty
let objExpr = if valu then objExpr else mkCoerceExpr(objExpr, tgty, m, tyOfExpr g objExpr)
let wrap, objExpr = mkExprAddrOfExpr g valu false DefinitelyMutates objExpr None m
@@ -4929,11 +4932,7 @@ and TcTypeApp cenv newOk checkCxs occ env tpenv m tcref pathTypeArgs (synArgTys:
List.iter2 (UnifyTypes cenv env m) tinst actualArgTys
// Try to decode System.Tuple --> F~ tuple types etc.
- let ty =
- let decode = if cenv.g.compilingFslib then None else cenv.g.decodeTyconRefMap tcref actualArgTys
- match decode with
- | Some res -> res
- | None -> mkAppTy tcref actualArgTys
+ let ty = cenv.g.decompileType tcref actualArgTys
ty, tpenv
@@ -4954,6 +4953,7 @@ and TcTypeAndRecover cenv newOk checkCxs occ env tpenv ty =
TcTypeOrMeasureAndRecover (Some TyparKind.Type) cenv newOk checkCxs occ env tpenv ty
and TcNestedTypeApplication cenv newOk checkCxs occ env tpenv mWholeTypeApp typ tyargs =
+ let typ = helpEnsureTypeHasMetadata cenv.g typ
if not (isAppTy cenv.g typ) then error(Error(FSComp.SR.tcTypeHasNoNestedTypes(), mWholeTypeApp))
match typ with
| TType_app(tcref, tinst) ->
@@ -5567,7 +5567,7 @@ and TcStmtThatCantBeCtorBody cenv env tpenv expr =
and TcStmt cenv env tpenv synExpr =
let expr, ty, tpenv = TcExprOfUnknownType cenv env tpenv synExpr
let m = synExpr.Range
- let wasUnit = UnifyUnitType cenv env.DisplayEnv m ty (Some expr)
+ let wasUnit = UnifyUnitType cenv env.DisplayEnv m ty expr
if wasUnit then
expr, tpenv
else
@@ -6234,7 +6234,7 @@ and TcNewExpr cenv env tpenv objTy mObjTyOpt superInit arg mWholeExprOrObjTy =
mkCallCreateInstance cenv.g mWholeExprOrObjTy objTy , tpenv
else
- if not (isAppTy cenv.g objTy) then error(Error(FSComp.SR.tcNamedTypeRequired(if superInit then "inherit" else "new"), mWholeExprOrObjTy))
+ if not (isAppTy cenv.g objTy) && not (isAnyTupleTy cenv.g objTy) then error(Error(FSComp.SR.tcNamedTypeRequired(if superInit then "inherit" else "new"), mWholeExprOrObjTy))
let item = ForceRaise (ResolveObjectConstructor cenv.nameResolver env.DisplayEnv mWholeExprOrObjTy ad objTy)
TcCtorCall false cenv env tpenv objTy objTy mObjTyOpt item superInit [arg] mWholeExprOrObjTy [] None
@@ -8658,7 +8658,7 @@ and TcItemThen cenv overallTy env tpenv (item, mItem, rest, afterResolution) del
| Item.CtorGroup(nm, minfos) ->
let objTy =
match minfos with
- | (minfo :: _) -> minfo.EnclosingType
+ | (minfo :: _) -> minfo.ApparentEnclosingType
| [] -> error(Error(FSComp.SR.tcTypeHasNoAccessibleConstructor(), mItem))
match delayed with
| ((DelayedApp (_, arg, mExprAndArg))::otherDelayed) ->
@@ -8684,7 +8684,7 @@ and TcItemThen cenv overallTy env tpenv (item, mItem, rest, afterResolution) del
#endif
item, minfos
- minfosAfterTyArgs |> List.iter (fun minfo -> UnifyTypes cenv env mExprAndTypeArgs minfo.EnclosingType objTyAfterTyArgs)
+ minfosAfterTyArgs |> List.iter (fun minfo -> UnifyTypes cenv env mExprAndTypeArgs minfo.ApparentEnclosingType objTyAfterTyArgs)
TcCtorCall true cenv env tpenv overallTy objTyAfterTyArgs (Some mExprAndTypeArgs) itemAfterTyArgs false [arg] mExprAndArg otherDelayed (Some afterResolution)
| ((DelayedTypeApp(tyargs, _mTypeArgs, mExprAndTypeArgs))::otherDelayed) ->
@@ -8695,7 +8695,7 @@ and TcItemThen cenv overallTy env tpenv (item, mItem, rest, afterResolution) del
let resolvedItem = Item.Types(nm, [objTy])
CallNameResolutionSink cenv.tcSink (mExprAndTypeArgs, env.NameEnv, resolvedItem, resolvedItem, emptyTyparInst, ItemOccurence.Use, env.DisplayEnv, env.eAccessRights)
- minfos |> List.iter (fun minfo -> UnifyTypes cenv env mExprAndTypeArgs minfo.EnclosingType objTy)
+ minfos |> List.iter (fun minfo -> UnifyTypes cenv env mExprAndTypeArgs minfo.ApparentEnclosingType objTy)
TcCtorCall true cenv env tpenv overallTy objTy (Some mExprAndTypeArgs) item false [] mExprAndTypeArgs otherDelayed (Some afterResolution)
| _ ->
@@ -8934,7 +8934,7 @@ and TcItemThen cenv overallTy env tpenv (item, mItem, rest, afterResolution) del
// The empty instantiation on the fspec is OK, since we make the correct fspec in IlxGen.GenAsm
// This ensures we always get the type instantiation right when doing this from
// polymorphic code, after inlining etc.
- let fspec = mkILFieldSpec(fref, mkILNamedTy valu fref.EnclosingTypeRef [])
+ let fspec = mkILFieldSpec(fref, mkILNamedTy valu fref.DeclaringTypeRef [])
// Add an I_nop if this is an initonly field to make sure we never recognize it as an lvalue. See mkExprAddrOfExpr.
mkAsmExpr ([ mkNormalLdsfld fspec ] @ (if finfo.IsInitOnly then [ AI_nop ] else []), finfo.TypeInst, [], [exprty], mItem)
@@ -9084,7 +9084,7 @@ and TcLookupThen cenv overallTy env tpenv mObjExpr objExpr objExprTy longId dela
| Item.RecdField rfinfo ->
// Get or set instance F# field or literal
RecdFieldInstanceChecks cenv.g cenv.amap ad mItem rfinfo
- let tgty = rfinfo.EnclosingType
+ let tgty = rfinfo.DeclaringType
let valu = isStructTy cenv.g tgty
AddCxTypeMustSubsumeType ContextInfo.NoContext env.DisplayEnv cenv.css mItem NoTrace tgty objExprTy
let objExpr = if valu then objExpr else mkCoerceExpr(objExpr, tgty, mExprAndItem, objExprTy)
@@ -9160,10 +9160,10 @@ and TcEventValueThen cenv overallTy env tpenv mItem mExprAndItem objDetails (ein
// EventHelper ((fun d -> e.add_X(d)), (fun d -> e.remove_X(d)), (fun f -> new 'Delegate(f)))
mkCallCreateEvent cenv.g mItem delegateType argsTy
(let dv, de = mkCompGenLocal mItem "eventDelegate" delegateType
- let callExpr, _ = BuildPossiblyConditionalMethodCall cenv env PossiblyMutates mItem false (einfo.GetAddMethod()) NormalValUse [] objVars [de]
+ let callExpr, _ = BuildPossiblyConditionalMethodCall cenv env PossiblyMutates mItem false einfo.AddMethod NormalValUse [] objVars [de]
mkLambda mItem dv (callExpr, cenv.g.unit_ty))
(let dv, de = mkCompGenLocal mItem "eventDelegate" delegateType
- let callExpr, _ = BuildPossiblyConditionalMethodCall cenv env PossiblyMutates mItem false (einfo.GetRemoveMethod()) NormalValUse [] objVars [de]
+ let callExpr, _ = BuildPossiblyConditionalMethodCall cenv env PossiblyMutates mItem false einfo.RemoveMethod NormalValUse [] objVars [de]
mkLambda mItem dv (callExpr, cenv.g.unit_ty))
(let fvty = (cenv.g.obj_ty --> (argsTy --> cenv.g.unit_ty))
let fv, fe = mkCompGenLocal mItem "callback" fvty
@@ -9629,20 +9629,20 @@ and TcMethodApplication
//
if (isInstance &&
finalCalledMethInfo.IsInstance &&
- typeEquiv cenv.g finalCalledMethInfo.EnclosingType cenv.g.obj_ty &&
+ typeEquiv cenv.g finalCalledMethInfo.ApparentEnclosingType cenv.g.obj_ty &&
(finalCalledMethInfo.LogicalName = "GetHashCode" || finalCalledMethInfo.LogicalName = "Equals")) then
objArgs |> List.iter (fun expr -> ConstraintSolver.AddCxTypeMustSupportEquality env.DisplayEnv cenv.css mMethExpr NoTrace (tyOfExpr cenv.g expr))
// Uses of a Dictionary() constructor without an IEqualityComparer argument imply an equality constraint
// on the first type argument.
- if HasHeadType cenv.g cenv.g.tcref_System_Collections_Generic_Dictionary finalCalledMethInfo.EnclosingType &&
+ if HasHeadType cenv.g cenv.g.tcref_System_Collections_Generic_Dictionary finalCalledMethInfo.ApparentEnclosingType &&
finalCalledMethInfo.IsConstructor &&
not (finalCalledMethInfo.GetParamDatas(cenv.amap, mItem, finalCalledMeth.CalledTyArgs)
|> List.existsSquared (fun (ParamData(_, _, _, _, _, _, ty)) ->
HasHeadType cenv.g cenv.g.tcref_System_Collections_Generic_IEqualityComparer ty)) then
- match argsOfAppTy cenv.g finalCalledMethInfo.EnclosingType with
+ match argsOfAppTy cenv.g finalCalledMethInfo.ApparentEnclosingType with
| [dty; _] -> ConstraintSolver.AddCxTypeMustSupportEquality env.DisplayEnv cenv.css mMethExpr NoTrace dty
| _ -> ()
end
@@ -10195,7 +10195,7 @@ and TcAndBuildFixedExpr cenv env (overallPatTy, fixedExpr, overallExprTy, mBindi
| Expr.Op (op, tyargs, args, _) ->
match op, tyargs, args with
| TOp.ValFieldGetAddr rfref, _, [_] -> not rfref.Tycon.IsStructOrEnumTycon
- | TOp.ILAsm ([ I_ldflda (fspec)], _), _, _ -> fspec.EnclosingType.Boxity = ILBoxity.AsObject
+ | TOp.ILAsm ([ I_ldflda (fspec)], _), _, _ -> fspec.DeclaringType.Boxity = ILBoxity.AsObject
| TOp.ILAsm ([ I_ldelema _], _), _, _ -> true
| TOp.RefAddrGet _, _, _ -> true
| _ -> false
@@ -10413,7 +10413,7 @@ and TcNormalizedBinding declKind (cenv:cenv) env tpenv overallTy safeThisValOpt
else TcExprThatCantBeCtorBody cenv overallExprTy envinner tpenv rhsExpr)
if bkind = StandaloneExpression && not cenv.isScript then
- UnifyUnitType cenv env.DisplayEnv mBinding overallPatTy (Some rhsExprChecked) |> ignore
+ UnifyUnitType cenv env.DisplayEnv mBinding overallPatTy rhsExprChecked |> ignore
// Fix up the r.h.s. expression for 'fixed'
let rhsExprChecked =
@@ -10762,7 +10762,7 @@ and TcLetBinding cenv isUse env containerInfo declKind tpenv (binds, bindsm, sco
// This assignment forces representation as module value, to maintain the invariant from the
// type checker that anything related to binding module-level values is marked with an
- // val_repr_info, val_actual_parent and is_topbind
+ // val_repr_info, val_declaring_entity and is_topbind
if (DeclKind.MustHaveArity declKind) then
AdjustValToTopVal tmp altActualParent (InferArityOfExprBinding cenv.g AllowTypeDirectedDetupling.Yes tmp rhsExpr)
tmp, pat'
@@ -10931,7 +10931,7 @@ and ApplyAbstractSlotInference (cenv:cenv) (envinner:TcEnv) (bindingTy, m, synTy
let optInferredImplSlotTys =
match optIntfSlotTy with
| Some (x, _) -> [x]
- | None -> uniqueAbstractMethSigs |> List.map (fun x -> x.EnclosingType)
+ | None -> uniqueAbstractMethSigs |> List.map (fun x -> x.ApparentEnclosingType)
optInferredImplSlotTys, declaredTypars
@@ -10993,7 +10993,7 @@ and ApplyAbstractSlotInference (cenv:cenv) (envinner:TcEnv) (bindingTy, m, synTy
let optInferredImplSlotTys =
match optIntfSlotTy with
| Some (x, _) -> [ x ]
- | None -> uniqueAbstractPropSigs |> List.map (fun pinfo -> pinfo.EnclosingType)
+ | None -> uniqueAbstractPropSigs |> List.map (fun pinfo -> pinfo.ApparentEnclosingType)
optInferredImplSlotTys, declaredTypars
@@ -14307,7 +14307,7 @@ module TcExceptionDeclarations =
minfo.GenericArity = 0)
match candidates with
| [minfo] ->
- match minfo.EnclosingType with
+ match minfo.ApparentEnclosingType with
| AppTy cenv.g (tcref, _) as ety when (TypeDefinitelySubsumesTypeNoCoercion 0 cenv.g cenv.amap m cenv.g.exn_ty ety) ->
let tref = tcref.CompiledRepresentationForNamedType
TExnAsmRepr tref
diff --git a/src/fsharp/fsc.fs b/src/fsharp/fsc.fs
index b1ec3cfca0c..b355ac50c05 100644
--- a/src/fsharp/fsc.fs
+++ b/src/fsharp/fsc.fs
@@ -1091,7 +1091,7 @@ module StaticLinker =
match depILModule.Manifest with
| Some m ->
for ca in m.CustomAttrs.AsList do
- if ca.Method.MethodRef.EnclosingTypeRef.FullName = typeof.FullName then
+ if ca.Method.MethodRef.DeclaringTypeRef.FullName = typeof.FullName then
yield ca
| _ -> () ]
@@ -1201,7 +1201,7 @@ module StaticLinker =
|> List.map (fun md ->
{md with CustomAttrs =
mkILCustomAttrs (td.CustomAttrs.AsList |> List.filter (fun ilattr ->
- ilattr.Method.EnclosingType.TypeRef.FullName <> "System.Runtime.TargetedPatchingOptOutAttribute") )})
+ ilattr.Method.DeclaringType.TypeRef.FullName <> "System.Runtime.TargetedPatchingOptOutAttribute") )})
|> mkILMethods } ])}
//ILAsciiWriter.output_module stdout fakeModule
fakeModule.TypeDefs.AsList
@@ -1635,7 +1635,6 @@ let main0(ctok, argv, legacyReferenceResolver, bannerAlreadyPrinted, openBinarie
let directoryBuildingFrom = Directory.GetCurrentDirectory()
let setProcessThreadLocals tcConfigB =
tcConfigB.openBinariesInMemory <- openBinariesInMemory
-#if PREFERRED_UI_LANG
match tcConfigB.preferredUiLang with
#if FX_RESHAPED_GLOBALIZATION
| Some s -> System.Globalization.CultureInfo.CurrentUICulture <- new System.Globalization.CultureInfo(s)
@@ -1643,11 +1642,6 @@ let main0(ctok, argv, legacyReferenceResolver, bannerAlreadyPrinted, openBinarie
| Some s -> Thread.CurrentThread.CurrentUICulture <- new System.Globalization.CultureInfo(s)
#endif
| None -> ()
-#else
- match tcConfigB.lcid with
- | Some n -> Thread.CurrentThread.CurrentUICulture <- new CultureInfo(n)
- | None -> ()
-#endif
if tcConfigB.utf8output then
Console.OutputEncoding <- Encoding.UTF8
diff --git a/src/fsharp/fscmain.fs b/src/fsharp/fscmain.fs
index 9405af123bb..344656d6b52 100644
--- a/src/fsharp/fscmain.fs
+++ b/src/fsharp/fscmain.fs
@@ -48,7 +48,14 @@ module Driver =
failwithf "%s" <| FSComp.SR.elSysEnvExitDidntExit()
}
- mainCompile (ctok, argv, MSBuildReferenceResolver.Resolver, (*bannerAlreadyPrinted*)false, (*openBinariesInMemory*)false, (*defaultCopyFSharpCore*)true, quitProcessExiter, ConsoleLoggerProvider(), None, None)
+ let legacyReferenceResolver =
+#if CROSS_PLATFORM_COMPILER
+ SimulatedMSBuildReferenceResolver.SimulatedMSBuildResolver
+#else
+ MSBuildReferenceResolver.Resolver
+#endif
+
+ mainCompile (ctok, argv, legacyReferenceResolver, (*bannerAlreadyPrinted*)false, (*openBinariesInMemory*)false, (*defaultCopyFSharpCore*)true, quitProcessExiter, ConsoleLoggerProvider(), None, None)
0
[]
diff --git a/src/fsharp/fsi/fsi.fs b/src/fsharp/fsi/fsi.fs
index 1fb69f2fc4b..b79e6924506 100644
--- a/src/fsharp/fsi/fsi.fs
+++ b/src/fsharp/fsi/fsi.fs
@@ -2419,19 +2419,6 @@ type FsiEvaluationSession (fsi: FsiEvaluationSessionHostConfig, argv:string[], i
// We later switch to doing interaction-by-interaction processing on the "event loop" thread.
let ctokStartup = AssumeCompilationThreadWithoutEvidence ()
-#if FX_LCIDFROMCODEPAGE
-
- // See Bug 735819
- let lcidFromCodePage =
- if (Console.OutputEncoding.CodePage <> 65001) &&
- (Console.OutputEncoding.CodePage <> Thread.CurrentThread.CurrentUICulture.TextInfo.OEMCodePage) &&
- (Console.OutputEncoding.CodePage <> Thread.CurrentThread.CurrentUICulture.TextInfo.ANSICodePage) then
- Thread.CurrentThread.CurrentUICulture <- new CultureInfo("en-US")
- Some 1033
- else
- None
-#endif
-
let timeReporter = FsiTimeReporter(outWriter)
#if !FX_RESHAPED_CONSOLE
@@ -2494,19 +2481,14 @@ type FsiEvaluationSession (fsi: FsiEvaluationSessionHostConfig, argv:string[], i
let fsiOptions = FsiCommandLineOptions(fsi, argv, tcConfigB, fsiConsoleOutput)
let fsiConsolePrompt = FsiConsolePrompt(fsiOptions, fsiConsoleOutput)
- // Check if we have a codepage from the console
-#if FX_LCIDFROMCODEPAGE
do
- match fsiOptions.FsiLCID with
- | Some _ -> ()
- | None -> tcConfigB.lcid <- lcidFromCodePage
-
- // Set the ui culture
- do
- match fsiOptions.FsiLCID with
- | Some(n) -> Thread.CurrentThread.CurrentUICulture <- new CultureInfo(n)
- | None -> ()
+ match tcConfigB.preferredUiLang with
+#if FX_RESHAPED_GLOBALIZATION
+ | Some s -> System.Globalization.CultureInfo.CurrentUICulture <- new System.Globalization.CultureInfo(s)
+#else
+ | Some s -> Thread.CurrentThread.CurrentUICulture <- new System.Globalization.CultureInfo(s)
#endif
+ | None -> ()
#if !FX_NO_SERVERCODEPAGES
do
diff --git a/src/fsharp/fsi/fsimain.fs b/src/fsharp/fsi/fsimain.fs
index b87c795a605..002cfa54a4f 100644
--- a/src/fsharp/fsi/fsimain.fs
+++ b/src/fsharp/fsi/fsimain.fs
@@ -235,6 +235,12 @@ let evaluateSession(argv: string[]) =
None
#endif
+ let legacyReferenceResolver =
+#if CROSS_PLATFORM_COMPILER
+ SimulatedMSBuildReferenceResolver.SimulatedMSBuildResolver
+#else
+ MSBuildReferenceResolver.Resolver
+#endif
// Update the configuration to include 'StartServer', WinFormsEventLoop and 'GetOptionalConsoleReadLine()'
let rec fsiConfig =
{ new FsiEvaluationSessionHostConfig () with
@@ -251,21 +257,21 @@ let evaluateSession(argv: string[]) =
member __.ReportUserCommandLineArgs args = fsiConfig0.ReportUserCommandLineArgs args
member __.EventLoopRun() =
#if !FX_NO_WINFORMS
- match fsiWinFormsLoop.Value with
+ match (if fsiSession.IsGui then fsiWinFormsLoop.Value else None) with
| Some l -> (l :> IEventLoop).Run()
| _ ->
#endif
fsiConfig0.EventLoopRun()
member __.EventLoopInvoke(f) =
#if !FX_NO_WINFORMS
- match fsiWinFormsLoop.Value with
+ match (if fsiSession.IsGui then fsiWinFormsLoop.Value else None) with
| Some l -> (l :> IEventLoop).Invoke(f)
| _ ->
#endif
fsiConfig0.EventLoopInvoke(f)
member __.EventLoopScheduleRestart() =
#if !FX_NO_WINFORMS
- match fsiWinFormsLoop.Value with
+ match (if fsiSession.IsGui then fsiWinFormsLoop.Value else None) with
| Some l -> (l :> IEventLoop).ScheduleRestart()
| _ ->
#endif
@@ -279,7 +285,7 @@ let evaluateSession(argv: string[]) =
member __.GetOptionalConsoleReadLine(probe) = getConsoleReadLine(probe) }
// Create the console
- and fsiSession = FsiEvaluationSession.Create (fsiConfig, argv, Console.In, Console.Out, Console.Error, collectible=false, legacyReferenceResolver=MSBuildReferenceResolver.Resolver)
+ and fsiSession : FsiEvaluationSession = FsiEvaluationSession.Create (fsiConfig, argv, Console.In, Console.Out, Console.Error, collectible=false, legacyReferenceResolver=legacyReferenceResolver)
#if !FX_NO_WINFORMS
diff --git a/src/fsharp/import.fs b/src/fsharp/import.fs
index 6db631a0318..f6f5648d8e4 100644
--- a/src/fsharp/import.fs
+++ b/src/fsharp/import.fs
@@ -150,9 +150,7 @@ let CanImportILTypeRef (env:ImportMap) m (tref:ILTypeRef) =
/// Prefer the F# abbreviation for some built-in types, e.g. 'string' rather than
/// 'System.String', since we prefer the F# abbreviation to the .NET equivalents.
let ImportTyconRefApp (env:ImportMap) tcref tyargs =
- match env.g.betterTyconRefMap tcref tyargs with
- | Some res -> res
- | None -> TType_app (tcref,tyargs)
+ env.g.improveType tcref tyargs
/// Import an IL type as an F# type.
let rec ImportILType (env:ImportMap) m tinst typ =
diff --git a/src/fsharp/infos.fs b/src/fsharp/infos.fs
index 07ab90f403f..1a636574fe1 100755
--- a/src/fsharp/infos.fs
+++ b/src/fsharp/infos.fs
@@ -410,7 +410,7 @@ let GetCompiledReturnTyOfProvidedMethodInfo amap m (mi:Tainted
- let parentToMemberInst,_ = mkTyparToTyparRenaming (ovByMethValRef.MemberApparentParent.Typars(m)) enclosingTypars
+ let parentToMemberInst,_ = mkTyparToTyparRenaming (ovByMethValRef.MemberApparentEntity.Typars(m)) enclosingTypars
let res = instSlotSig parentToMemberInst slotsig
res
| None ->
@@ -659,30 +659,50 @@ let ArbitraryMethodInfoOfPropertyInfo (pi:Tainted) m =
[]
type ILTypeInfo =
/// ILTypeInfo (tyconRef, ilTypeRef, typeArgs, ilTypeDef).
- | ILTypeInfo of TyconRef * ILTypeRef * TypeInst * ILTypeDef
+ | ILTypeInfo of TcGlobals * TType * ILTypeRef * ILTypeDef
+
+ member x.TcGlobals = let (ILTypeInfo(g,_,_,_)) = x in g
+
+ member x.ILTypeRef = let (ILTypeInfo(_,_,tref,_)) = x in tref
- member x.TyconRef = let (ILTypeInfo(tcref,_,_,_)) = x in tcref
- member x.ILTypeRef = let (ILTypeInfo(_,tref,_,_)) = x in tref
- member x.TypeInst = let (ILTypeInfo(_,_,tinst,_)) = x in tinst
member x.RawMetadata = let (ILTypeInfo(_,_,_,tdef)) = x in tdef
- member x.ToType = TType_app(x.TyconRef,x.TypeInst)
+
+ member x.ToType = let (ILTypeInfo(_,ty,_,_)) = x in ty
+
+ /// Get the compiled nominal type. In the case of tuple types, this is a .NET tuple type
+ member x.ToAppType = helpEnsureTypeHasMetadata x.TcGlobals x.ToType
+
+ member x.TyconRefOfRawMetadata = tcrefOfAppTy x.TcGlobals x.ToAppType
+
+ member x.TypeInstOfRawMetadata = argsOfAppTy x.TcGlobals x.ToAppType
+
member x.ILScopeRef = x.ILTypeRef.Scope
+
member x.Name = x.ILTypeRef.Name
+
member x.IsValueType = x.RawMetadata.IsStructOrEnum
- member x.Instantiate inst =
- let (ILTypeInfo(tcref,tref,tinst,tdef)) = x
- ILTypeInfo(tcref,tref,instTypes inst tinst,tdef)
- member x.FormalTypars m = x.TyconRef.Typars m
+ member x.Instantiate inst =
+ let (ILTypeInfo(g,ty,tref,tdef)) = x
+ ILTypeInfo(g,instType inst ty,tref,tdef)
static member FromType g ty =
- if isILAppTy g ty then
- let tcref,tinst = destAppTy g ty
- let (TILObjectReprData(scoref,enc,tdef)) = tcref.ILTyconInfo
+ if isAnyTupleTy g ty then
+ // When getting .NET metadata for the properties and methods
+ // of an F# tuple type, use the compiled nominal type, which is a .NET tuple type
+ let metadataTy = helpEnsureTypeHasMetadata g ty
+ assert (isILAppTy g metadataTy)
+ let metadataTyconRef = tcrefOfAppTy g metadataTy
+ let (TILObjectReprData(scoref, enc, tdef)) = metadataTyconRef.ILTyconInfo
+ let metadataILTypeRef = mkRefForNestedILTypeDef scoref (enc,tdef)
+ ILTypeInfo(g, ty, metadataILTypeRef, tdef)
+ elif isILAppTy g ty then
+ let tcref = tcrefOfAppTy g ty
+ let (TILObjectReprData(scoref, enc, tdef)) = tcref.ILTyconInfo
let tref = mkRefForNestedILTypeDef scoref (enc,tdef)
- ILTypeInfo(tcref,tref,tinst,tdef)
+ ILTypeInfo(g, ty, tref, tdef)
else
- failwith "ILTypeInfo.FromType"
+ failwith "ILTypeInfo.FromType - no IL metadata for type"
//-------------------------------------------------------------------------
// ILMethInfo
@@ -702,12 +722,15 @@ type ILMethInfo =
member x.TcGlobals = match x with ILMethInfo(g,_,_,_,_) -> g
/// Get the apparent declaring type of the method as an F# type.
- /// If this is an C#-style extension method then this is the type which the method
+ /// If this is a C#-style extension method then this is the type which the method
/// appears to extend. This may be a variable type.
member x.ApparentEnclosingType = match x with ILMethInfo(_,ty,_,_,_) -> ty
+ /// Like ApparentEnclosingType but use the compiled nominal type if this is a method on a tuple type
+ member x.ApparentEnclosingAppType = helpEnsureTypeHasMetadata x.TcGlobals x.ApparentEnclosingType
+
/// Get the declaring type associated with an extension member, if any.
- member x.DeclaringTyconRefOption = match x with ILMethInfo(_,_,tcrefOpt,_,_) -> tcrefOpt
+ member x.ILExtensionMethodDeclaringTyconRef = match x with ILMethInfo(_,_,tcrefOpt,_,_) -> tcrefOpt
/// Get the Abstract IL metadata associated with the method.
member x.RawMetadata = match x with ILMethInfo(_,_,_,md,_) -> md
@@ -719,20 +742,21 @@ type ILMethInfo =
member x.ILName = x.RawMetadata.Name
/// Indicates if the method is an extension method
- member x.IsILExtensionMethod = x.DeclaringTyconRefOption.IsSome
+ member x.IsILExtensionMethod = x.ILExtensionMethodDeclaringTyconRef.IsSome
/// Get the declaring type of the method. If this is an C#-style extension method then this is the IL type
/// holding the static member that is the extension method.
member x.DeclaringTyconRef =
- match x.DeclaringTyconRefOption with
+ match x.ILExtensionMethodDeclaringTyconRef with
| Some tcref -> tcref
- | None -> tcrefOfAppTy x.TcGlobals x.ApparentEnclosingType
+ | None -> tcrefOfAppTy x.TcGlobals x.ApparentEnclosingAppType
/// Get the instantiation of the declaring type of the method.
/// If this is an C#-style extension method then this is empty because extension members
/// are never in generic classes.
member x.DeclaringTypeInst =
- if x.IsILExtensionMethod then [] else argsOfAppTy x.TcGlobals x.ApparentEnclosingType
+ if x.IsILExtensionMethod then []
+ else argsOfAppTy x.TcGlobals x.ApparentEnclosingAppType
/// Get the Abstract IL scope information associated with interpreting the Abstract IL metadata that backs this method.
member x.MetadataScope = x.DeclaringTyconRef.CompiledRepresentationForNamedType.Scope
@@ -845,7 +869,7 @@ type ILMethInfo =
/// Describes an F# use of a method
[]
type MethInfo =
- /// FSMeth(tcGlobals, declaringType, valRef, extensionMethodPriority).
+ /// FSMeth(tcGlobals, enclosingType, valRef, extensionMethodPriority).
///
/// Describes a use of a method declared in F# code and backed by F# metadata.
| FSMeth of TcGlobals * TType * ValRef * ExtensionMethodPriority option
@@ -867,24 +891,33 @@ type MethInfo =
///
/// If this is an extension member, then this is the apparent parent, i.e. the type the method appears to extend.
/// This may be a variable type.
- member x.EnclosingType =
+ member x.ApparentEnclosingType =
match x with
- | ILMeth(_g,ilminfo,_) -> ilminfo.ApparentEnclosingType
- | FSMeth(_g,typ,_,_) -> typ
- | DefaultStructCtor(_g,typ) -> typ
+ | ILMeth(_,ilminfo,_) -> ilminfo.ApparentEnclosingType
+ | FSMeth(_,typ,_,_) -> typ
+ | DefaultStructCtor(_,typ) -> typ
#if !NO_EXTENSIONTYPING
| ProvidedMeth(amap,mi,_,m) ->
Import.ImportProvidedType amap m (mi.PApply((fun mi -> mi.DeclaringType),m))
#endif
+ /// Get the enclosing type of the method info, using a nominal type for tuple types
+ member x.ApparentEnclosingAppType =
+ match x with
+ | ILMeth(_,ilminfo,_) -> ilminfo.ApparentEnclosingAppType
+ | _ -> x.ApparentEnclosingType
+
+ member x.ApparentEnclosingTyconRef =
+ tcrefOfAppTy x.TcGlobals x.ApparentEnclosingAppType
+
/// Get the declaring type or module holding the method. If this is an C#-style extension method then this is the type
/// holding the static member that is the extension method. If this is an F#-style extension method it is the logical module
/// holding the value for the extension method.
- member x.DeclaringEntityRef =
+ member x.DeclaringTyconRef =
match x with
| ILMeth(_,ilminfo,_) when x.IsExtensionMember -> ilminfo.DeclaringTyconRef
- | FSMeth(_,_,vref,_) when x.IsExtensionMember && vref.HasTopValActualParent -> vref.TopValActualParent
- | _ -> tcrefOfAppTy x.TcGlobals x.EnclosingType
+ | FSMeth(_,_,vref,_) when x.IsExtensionMember && vref.HasDeclaringEntity -> vref.TopValDeclaringEntity
+ | _ -> x.ApparentEnclosingTyconRef
/// Get the information about provided static parameters, if any
member x.ProvidedStaticParameterInfo =
@@ -954,13 +987,13 @@ type MethInfo =
#endif
| _ -> false
- override x.ToString() = x.EnclosingType.ToString() + x.LogicalName
+ override x.ToString() = x.ApparentEnclosingType.ToString() + x.LogicalName
/// Get the actual type instantiation of the declaring type associated with this use of the method.
///
/// For extension members this is empty (the instantiation of the declaring type).
member x.DeclaringTypeInst =
- if x.IsExtensionMember then [] else argsOfAppTy x.TcGlobals x.EnclosingType
+ if x.IsExtensionMember then [] else argsOfAppTy x.TcGlobals x.ApparentEnclosingAppType
/// Get the TcGlobals value that governs the method declaration
member x.TcGlobals =
@@ -1080,7 +1113,7 @@ type MethInfo =
match x with
| ILMeth(_g,ilmeth,_) -> ilmeth.IsVirtual
| FSMeth(g,_,vref,_) as x ->
- isInterfaceTy g x.EnclosingType ||
+ isInterfaceTy g x.ApparentEnclosingType ||
vref.MemberInfo.Value.MemberFlags.IsDispatchSlot
| DefaultStructCtor _ -> false
#if !NO_EXTENSIONTYPING
@@ -1107,14 +1140,14 @@ type MethInfo =
member minfo.IsAbstract =
match minfo with
| ILMeth(_,ilmeth,_) -> ilmeth.IsAbstract
- | FSMeth(g,_,vref,_) -> isInterfaceTy g minfo.EnclosingType || vref.IsDispatchSlotMember
+ | FSMeth(g,_,vref,_) -> isInterfaceTy g minfo.ApparentEnclosingType || vref.IsDispatchSlotMember
| DefaultStructCtor _ -> false
#if !NO_EXTENSIONTYPING
| ProvidedMeth(_,mi,_,m) -> mi.PUntaint((fun mi -> mi.IsAbstract), m)
#endif
member x.IsNewSlot =
- isInterfaceTy x.TcGlobals x.EnclosingType ||
+ isInterfaceTy x.TcGlobals x.ApparentEnclosingType ||
(x.IsVirtual &&
(match x with
| ILMeth(_,x,_) -> x.IsNewSlot
@@ -1173,7 +1206,7 @@ type MethInfo =
// but is compiled as a generic methods with two type arguments
// Map<'T,'U>(this: List<'T>, f : 'T -> 'U)
member x.AdjustUserTypeInstForFSharpStyleIndexedExtensionMembers(tyargs) =
- (if x.IsFSharpStyleExtensionMember then argsOfAppTy x.TcGlobals x.EnclosingType else []) @ tyargs
+ (if x.IsFSharpStyleExtensionMember then argsOfAppTy x.TcGlobals x.ApparentEnclosingAppType else []) @ tyargs
/// Indicates if this method is a generated method associated with an F# CLIEvent property compiled as a .NET event
member x.IsFSharpEventPropertyMethod =
@@ -1191,13 +1224,13 @@ type MethInfo =
///
/// For an extension method, this indicates if the method extends a struct type.
member x.IsStruct =
- isStructTy x.TcGlobals x.EnclosingType
+ isStructTy x.TcGlobals x.ApparentEnclosingType
/// Build IL method infos.
static member CreateILMeth (amap:Import.ImportMap, m, typ:TType, md: ILMethodDef) =
let tinfo = ILTypeInfo.FromType amap.g typ
- let mtps = Import.ImportILGenericParameters (fun () -> amap) m tinfo.ILScopeRef tinfo.TypeInst md.GenericParams
- ILMeth (amap.g,ILMethInfo(amap.g,tinfo.ToType,None,md,mtps),None)
+ let mtps = Import.ImportILGenericParameters (fun () -> amap) m tinfo.ILScopeRef tinfo.TypeInstOfRawMetadata md.GenericParams
+ ILMeth (amap.g,ILMethInfo(amap.g, typ, None, md, mtps),None)
/// Build IL method infos for a C#-style extension method
static member CreateILExtensionMeth (amap, m, apparentTy:TType, declaringTyconRef:TyconRef, extMethPri, md: ILMethodDef) =
@@ -1211,7 +1244,7 @@ type MethInfo =
match x1,x2 with
| ILMeth(_,x1,_), ILMeth(_,x2,_) -> (x1.RawMetadata === x2.RawMetadata)
| FSMeth(g,_,vref1,_), FSMeth(_,_,vref2,_) -> valRefEq g vref1 vref2
- | DefaultStructCtor(g,ty1), DefaultStructCtor(_,ty2) -> tyconRefEq g (tcrefOfAppTy g ty1) (tcrefOfAppTy g ty2)
+ | DefaultStructCtor _, DefaultStructCtor _ -> tyconRefEq x1.TcGlobals x1.DeclaringTyconRef x2.DeclaringTyconRef
#if !NO_EXTENSIONTYPING
| ProvidedMeth(_,mi1,_,_),ProvidedMeth(_,mi2,_,_) -> ProvidedMethodBase.TaintedEquals (mi1, mi2)
#endif
@@ -1423,7 +1456,7 @@ type MethInfo =
// The FSMeth, ILMeth+ProvidedMeth paths can probably be unified too.
member x.GetSlotSig(amap, m) =
match x with
- | FSMeth(g,typ,vref,_) ->
+ | FSMeth(g,_,vref,_) ->
match vref.RecursiveValInfo with
| ValInRecScope(false) -> error(Error((FSComp.SR.InvalidRecursiveReferenceToAbstractSlot()),m))
| _ -> ()
@@ -1431,14 +1464,14 @@ type MethInfo =
let allTyparsFromMethod,_,retTy,_ = GetTypeOfMemberInMemberForm g vref
// A slot signature is w.r.t. the type variables of the type it is associated with.
// So we have to rename from the member type variables to the type variables of the type.
- let formalEnclosingTypars = (tcrefOfAppTy g typ).Typars(m)
+ let formalEnclosingTypars = x.ApparentEnclosingTyconRef.Typars(m)
let formalEnclosingTyparsFromMethod,formalMethTypars = List.chop formalEnclosingTypars.Length allTyparsFromMethod
let methodToParentRenaming,_ = mkTyparToTyparRenaming formalEnclosingTyparsFromMethod formalEnclosingTypars
let formalParams =
GetArgInfosOfMember x.IsCSharpStyleExtensionMember g vref
|> List.mapSquared (map1Of2 (instType methodToParentRenaming) >> MakeSlotParam )
let formalRetTy = Option.map (instType methodToParentRenaming) retTy
- MakeSlotSig(x.LogicalName, x.EnclosingType, formalEnclosingTypars, formalMethTypars, formalParams, formalRetTy)
+ MakeSlotSig(x.LogicalName, x.ApparentEnclosingType, formalEnclosingTypars, formalMethTypars, formalParams, formalRetTy)
| DefaultStructCtor _ -> error(InternalError("no slotsig for DefaultStructCtor",m))
| _ ->
let g = x.TcGlobals
@@ -1448,7 +1481,7 @@ type MethInfo =
// happens to make the return type 'unit' (i.e. it was originally a variable type
// then that does not correspond to a slotsig compiled as a 'void' return type.
// REVIEW: should we copy down attributes to slot params?
- let tcref = tcrefOfAppTy g x.EnclosingType
+ let tcref = tcrefOfAppTy g x.ApparentEnclosingAppType
let formalEnclosingTyparsOrig = tcref.Typars(m)
let formalEnclosingTypars = copyTypars formalEnclosingTyparsOrig
let _,formalEnclosingTyparTys = FixupNewTypars m [] [] formalEnclosingTyparsOrig formalEnclosingTypars
@@ -1458,10 +1491,10 @@ type MethInfo =
match x with
| ILMeth(_,ilminfo,_) ->
let ftinfo = ILTypeInfo.FromType g (TType_app(tcref,formalEnclosingTyparTys))
- let formalRetTy = ImportReturnTypeFromMetaData amap m ilminfo.RawMetadata.Return.Type ftinfo.ILScopeRef ftinfo.TypeInst formalMethTyparTys
+ let formalRetTy = ImportReturnTypeFromMetaData amap m ilminfo.RawMetadata.Return.Type ftinfo.ILScopeRef ftinfo.TypeInstOfRawMetadata formalMethTyparTys
let formalParams =
[ [ for p in ilminfo.RawMetadata.Parameters do
- let paramType = ImportILTypeFromMetadata amap m ftinfo.ILScopeRef ftinfo.TypeInst formalMethTyparTys p.Type
+ let paramType = ImportILTypeFromMetadata amap m ftinfo.ILScopeRef ftinfo.TypeInstOfRawMetadata formalMethTyparTys p.Type
yield TSlotParam(p.Name, paramType, p.IsIn, p.IsOut, p.IsOptional, []) ] ]
formalRetTy, formalParams
#if !NO_EXTENSIONTYPING
@@ -1480,7 +1513,7 @@ type MethInfo =
formalRetTy, formalParams
#endif
| _ -> failwith "unreachable"
- MakeSlotSig(x.LogicalName, x.EnclosingType, formalEnclosingTypars, formalMethTypars,formalParams, formalRetTy)
+ MakeSlotSig(x.LogicalName, x.ApparentEnclosingType, formalEnclosingTypars, formalMethTypars,formalParams, formalRetTy)
/// Get the ParamData objects for the parameters of a MethInfo
member x.GetParamDatas(amap, m, minst) =
@@ -1528,16 +1561,11 @@ type MethInfo =
if x.IsExtensionMember then []
else
match x with
- | ILMeth(_,ilminfo,_) -> ilminfo.DeclaringTyconRef.Typars m
| FSMeth(g,typ,vref,_) ->
let memberParentTypars,_,_,_ = AnalyzeTypeOfMemberVal false g (typ,vref)
memberParentTypars
- | DefaultStructCtor(g,typ) ->
- (tcrefOfAppTy g typ).Typars(m)
-#if !NO_EXTENSIONTYPING
- | ProvidedMeth (amap,_,_,_) ->
- (tcrefOfAppTy amap.g x.EnclosingType).Typars(m)
-#endif
+ | _ ->
+ x.DeclaringTyconRef.Typars(m)
//-------------------------------------------------------------------------
// ILFieldInfo
@@ -1554,13 +1582,26 @@ type ILFieldInfo =
#endif
/// Get the enclosing ("parent"/"declaring") type of the field.
- member x.EnclosingType =
+ member x.ApparentEnclosingType =
match x with
| ILFieldInfo(tinfo,_) -> tinfo.ToType
#if !NO_EXTENSIONTYPING
| ProvidedField(amap,fi,m) -> (Import.ImportProvidedType amap m (fi.PApply((fun fi -> fi.DeclaringType),m)))
#endif
+ member x.ApparentEnclosingAppType = x.ApparentEnclosingType
+
+ member x.ApparentEnclosingTyconRef = tcrefOfAppTy x.TcGlobals x.ApparentEnclosingAppType
+
+ member x.DeclaringTyconRef = x.ApparentEnclosingTyconRef
+
+ member x.TcGlobals =
+ match x with
+ | ILFieldInfo(tinfo,_) -> tinfo.TcGlobals
+#if !NO_EXTENSIONTYPING
+ | ProvidedField(amap,_,_) -> amap.g
+#endif
+
/// Get a reference to the declaring type of the field as an ILTypeRef
member x.ILTypeRef =
match x with
@@ -1572,10 +1613,10 @@ type ILFieldInfo =
/// Get the scope used to interpret IL metadata
member x.ScopeRef = x.ILTypeRef.Scope
- /// Get the type instantiation of the declaring type of the field
+ /// Get the type instantiation of the declaring type of the field
member x.TypeInst =
match x with
- | ILFieldInfo(tinfo,_) -> tinfo.TypeInst
+ | ILFieldInfo(tinfo,_) -> tinfo.TypeInstOfRawMetadata
#if !NO_EXTENSIONTYPING
| ProvidedField _ -> [] /// GENERIC TYPE PROVIDERS
#endif
@@ -1601,7 +1642,7 @@ type ILFieldInfo =
match x with
| ILFieldInfo(tinfo,_) -> tinfo.IsValueType
#if !NO_EXTENSIONTYPING
- | ProvidedField(amap,_,_) -> isStructTy amap.g x.EnclosingType
+ | ProvidedField(amap,_,_) -> isStructTy amap.g x.ApparentEnclosingType
#endif
/// Indicates if the field is static
@@ -1643,7 +1684,7 @@ type ILFieldInfo =
/// Get the type of the field as an F# type
member x.FieldType(amap,m) =
match x with
- | ILFieldInfo (tinfo,fdef) -> ImportILTypeFromMetadata amap m tinfo.ILScopeRef tinfo.TypeInst [] fdef.Type
+ | ILFieldInfo (tinfo,fdef) -> ImportILTypeFromMetadata amap m tinfo.ILScopeRef tinfo.TypeInstOfRawMetadata [] fdef.Type
#if !NO_EXTENSIONTYPING
| ProvidedField(amap,fi,m) -> Import.ImportProvidedType amap m (fi.PApply((fun fi -> fi.FieldType),m))
#endif
@@ -1693,7 +1734,7 @@ type RecdFieldInfo =
member x.FieldType = actualTyOfRecdFieldRef x.RecdFieldRef x.TypeInst
/// Get the enclosing (declaring) type of the field in an F#-declared record, class or struct type
- member x.EnclosingType = TType_app (x.RecdFieldRef.TyconRef,x.TypeInst)
+ member x.DeclaringType = TType_app (x.RecdFieldRef.TyconRef,x.TypeInst)
override x.ToString() = x.TyconRef.ToString() + "::" + x.Name
@@ -1731,26 +1772,37 @@ type UnionCaseInfo =
type ILPropInfo =
| ILPropInfo of ILTypeInfo * ILPropertyDef
+ /// Get the TcGlobals governing this value
+ member x.TcGlobals = match x with ILPropInfo(tinfo,_) -> tinfo.TcGlobals
+
/// Get the declaring IL type of the IL property, including any generic instantiation
- member x.ILTypeInfo = match x with (ILPropInfo(tinfo,_)) -> tinfo
+ member x.ILTypeInfo = match x with ILPropInfo(tinfo,_) -> tinfo
+
+ /// Get the apparent declaring type of the method as an F# type.
+ /// If this is a C#-style extension method then this is the type which the method
+ /// appears to extend. This may be a variable type.
+ member x.ApparentEnclosingType = match x with ILPropInfo(tinfo,_) -> tinfo.ToType
+
+ /// Like ApparentEnclosingType but use the compiled nominal type if this is a method on a tuple type
+ member x.ApparentEnclosingAppType = helpEnsureTypeHasMetadata x.TcGlobals x.ApparentEnclosingType
/// Get the raw Abstract IL metadata for the IL property
- member x.RawMetadata = match x with (ILPropInfo(_,pd)) -> pd
+ member x.RawMetadata = match x with ILPropInfo(_,pd) -> pd
/// Get the name of the IL property
member x.PropertyName = x.RawMetadata.Name
/// Gets the ILMethInfo of the 'get' method for the IL property
- member x.GetterMethod(g) =
+ member x.GetterMethod =
assert x.HasGetter
let mdef = resolveILMethodRef x.ILTypeInfo.RawMetadata x.RawMetadata.GetMethod.Value
- ILMethInfo(g,x.ILTypeInfo.ToType,None,mdef,[])
+ ILMethInfo(x.TcGlobals,x.ILTypeInfo.ToType,None,mdef,[])
/// Gets the ILMethInfo of the 'set' method for the IL property
- member x.SetterMethod(g) =
+ member x.SetterMethod =
assert x.HasSetter
let mdef = resolveILMethodRef x.ILTypeInfo.RawMetadata x.RawMetadata.SetMethod.Value
- ILMethInfo(g,x.ILTypeInfo.ToType,None,mdef,[])
+ ILMethInfo(x.TcGlobals,x.ILTypeInfo.ToType,None,mdef,[])
/// Indicates if the IL property has a 'get' method
member x.HasGetter = Option.isSome x.RawMetadata.GetMethod
@@ -1762,35 +1814,35 @@ type ILPropInfo =
member x.IsStatic = (x.RawMetadata.CallingConv = ILThisConvention.Static)
/// Indicates if the IL property is virtual
- member x.IsVirtual(g) =
- (x.HasGetter && x.GetterMethod(g).IsVirtual) ||
- (x.HasSetter && x.SetterMethod(g).IsVirtual)
+ member x.IsVirtual =
+ (x.HasGetter && x.GetterMethod.IsVirtual) ||
+ (x.HasSetter && x.SetterMethod.IsVirtual)
/// Indicates if the IL property is logically a 'newslot', i.e. hides any previous slots of the same name.
- member x.IsNewSlot(g) =
- (x.HasGetter && x.GetterMethod(g).IsNewSlot) ||
- (x.HasSetter && x.SetterMethod(g).IsNewSlot)
+ member x.IsNewSlot =
+ (x.HasGetter && x.GetterMethod.IsNewSlot) ||
+ (x.HasSetter && x.SetterMethod.IsNewSlot)
/// Get the names and types of the indexer arguments associated with the IL property.
///
/// Any type parameters of the enclosing type are instantiated in the type returned.
member x.GetParamNamesAndTypes(amap,m) =
let (ILPropInfo (tinfo,pdef)) = x
- pdef.Args |> List.map (fun ty -> ParamNameAndType(None, ImportILTypeFromMetadata amap m tinfo.ILScopeRef tinfo.TypeInst [] ty) )
+ pdef.Args |> List.map (fun ty -> ParamNameAndType(None, ImportILTypeFromMetadata amap m tinfo.ILScopeRef tinfo.TypeInstOfRawMetadata [] ty) )
/// Get the types of the indexer arguments associated with the IL property.
///
/// Any type parameters of the enclosing type are instantiated in the type returned.
member x.GetParamTypes(amap,m) =
let (ILPropInfo (tinfo,pdef)) = x
- pdef.Args |> List.map (fun ty -> ImportILTypeFromMetadata amap m tinfo.ILScopeRef tinfo.TypeInst [] ty)
+ pdef.Args |> List.map (fun ty -> ImportILTypeFromMetadata amap m tinfo.ILScopeRef tinfo.TypeInstOfRawMetadata [] ty)
/// Get the return type of the IL property.
///
/// Any type parameters of the enclosing type are instantiated in the type returned.
member x.GetPropertyType (amap,m) =
let (ILPropInfo (tinfo,pdef)) = x
- ImportILTypeFromMetadata amap m tinfo.ILScopeRef tinfo.TypeInst [] pdef.Type
+ ImportILTypeFromMetadata amap m tinfo.ILScopeRef tinfo.TypeInstOfRawMetadata [] pdef.Type
override x.ToString() = x.ILTypeInfo.ToString() + "::" + x.PropertyName
@@ -1802,14 +1854,43 @@ type PropInfo =
/// An F# use of a property backed by F#-declared metadata
| FSProp of TcGlobals * TType * ValRef option * ValRef option
/// An F# use of a property backed by Abstract IL metadata
- | ILProp of TcGlobals * ILPropInfo
+ | ILProp of ILPropInfo
#if !NO_EXTENSIONTYPING
/// An F# use of a property backed by provided metadata
| ProvidedProp of Import.ImportMap * Tainted * range
#endif
+ /// Get the enclosing type of the property.
+ ///
+ /// If this is an extension member, then this is the apparent parent, i.e. the type the property appears to extend.
+ member x.ApparentEnclosingType =
+ match x with
+ | ILProp ilpinfo -> ilpinfo.ILTypeInfo.ToType
+ | FSProp(_,typ,_,_) -> typ
+#if !NO_EXTENSIONTYPING
+ | ProvidedProp(amap,pi,m) ->
+ Import.ImportProvidedType amap m (pi.PApply((fun pi -> pi.DeclaringType),m))
+#endif
+
+ /// Get the enclosing type of the method info, using a nominal type for tuple types
+ member x.ApparentEnclosingAppType =
+ match x with
+ | ILProp ilpinfo -> ilpinfo.ApparentEnclosingAppType
+ | _ -> x.ApparentEnclosingType
+
+ member x.ApparentEnclosingTyconRef = tcrefOfAppTy x.TcGlobals x.ApparentEnclosingAppType
+
+ /// Get the declaring type or module holding the method.
+ /// Note that C#-style extension properties don't exist in the C# design as yet.
+ /// If this is an F#-style extension method it is the logical module
+ /// holding the value for the extension method.
+ member x.DeclaringTyconRef =
+ match x.ArbitraryValRef with
+ | Some vref when x.IsExtensionMember && vref.HasDeclaringEntity -> vref.TopValDeclaringEntity
+ | _ -> x.ApparentEnclosingTyconRef
+
/// Try to get an arbitrary F# ValRef associated with the member. This is to determine if the member is virtual, amongst other things.
- member x.ArbitraryValRef =
+ member x.ArbitraryValRef : ValRef option =
match x with
| FSProp(_,_,Some vref,_)
| FSProp(_,_,_, Some vref) -> Some vref
@@ -1829,7 +1910,7 @@ type PropInfo =
/// Get the logical name of the property.
member x.PropertyName =
match x with
- | ILProp(_,x) -> x.PropertyName
+ | ILProp ilpinfo -> ilpinfo.PropertyName
| FSProp(_,_,Some vref,_)
| FSProp(_,_,_, Some vref) -> vref.PropertyName
#if !NO_EXTENSIONTYPING
@@ -1840,7 +1921,7 @@ type PropInfo =
/// Indicates if this property has an associated getter method.
member x.HasGetter =
match x with
- | ILProp(_,x) -> x.HasGetter
+ | ILProp ilpinfo-> ilpinfo.HasGetter
| FSProp(_,_,x,_) -> Option.isSome x
#if !NO_EXTENSIONTYPING
| ProvidedProp(_,pi,m) -> pi.PUntaint((fun pi -> pi.CanRead),m)
@@ -1849,33 +1930,24 @@ type PropInfo =
/// Indicates if this property has an associated setter method.
member x.HasSetter =
match x with
- | ILProp(_,x) -> x.HasSetter
+ | ILProp ilpinfo -> ilpinfo.HasSetter
| FSProp(_,_,_,x) -> Option.isSome x
#if !NO_EXTENSIONTYPING
| ProvidedProp(_,pi,m) -> pi.PUntaint((fun pi -> pi.CanWrite),m)
#endif
- /// Get the enclosing type of the property.
- ///
- /// If this is an extension member, then this is the apparent parent, i.e. the type the property appears to extend.
- member x.EnclosingType =
- match x with
- | ILProp(_,x) -> x.ILTypeInfo.ToType
- | FSProp(_,typ,_,_) -> typ
-#if !NO_EXTENSIONTYPING
- | ProvidedProp(amap,pi,m) ->
- Import.ImportProvidedType amap m (pi.PApply((fun pi -> pi.DeclaringType),m))
-#endif
/// Indicates if this is an extension member
member x.IsExtensionMember =
- match x.ArbitraryValRef with Some vref -> vref.IsExtensionMember | _ -> false
+ match x.ArbitraryValRef with
+ | Some vref -> vref.IsExtensionMember
+ | _ -> false
/// True if the getter (or, if absent, the setter) is a virtual method
// REVIEW: for IL properties this is getter OR setter. For F# properties it is getter ELSE setter
member x.IsVirtualProperty =
match x with
- | ILProp(g,x) -> x.IsVirtual(g)
+ | ILProp ilpinfo -> ilpinfo.IsVirtual
| FSProp(_,_,Some vref,_)
| FSProp(_,_,_, Some vref) -> vref.IsVirtualMember
| FSProp _-> failwith "unreachable"
@@ -1888,7 +1960,7 @@ type PropInfo =
/// Indicates if the property is logically a 'newslot', i.e. hides any previous slots of the same name.
member x.IsNewSlot =
match x with
- | ILProp(g,x) -> x.IsNewSlot(g)
+ | ILProp ilpinfo -> ilpinfo.IsNewSlot
| FSProp(_,_,Some vref,_)
| FSProp(_,_,_, Some vref) -> vref.IsDispatchSlotMember
| FSProp(_,_,None,None) -> failwith "unreachable"
@@ -1903,7 +1975,7 @@ type PropInfo =
// REVIEW: for IL properties this is getter OR setter. For F# properties it is getter ELSE setter
member x.IsDispatchSlot =
match x with
- | ILProp(g,x) -> x.IsVirtual(g)
+ | ILProp ilpinfo -> ilpinfo.IsVirtual
| FSProp(g,typ,Some vref,_)
| FSProp(g,typ,_, Some vref) ->
isInterfaceTy g typ || (vref.MemberInfo.Value.MemberFlags.IsDispatchSlot)
@@ -1917,7 +1989,7 @@ type PropInfo =
/// Indicates if this property is static.
member x.IsStatic =
match x with
- | ILProp(_,x) -> x.IsStatic
+ | ILProp ilpinfo -> ilpinfo.IsStatic
| FSProp(_,_,Some vref,_)
| FSProp(_,_,_, Some vref) -> not vref.IsInstanceMember
| FSProp(_,_,None,None) -> failwith "unreachable"
@@ -1944,7 +2016,7 @@ type PropInfo =
/// Indicates if this property is an indexer property, i.e. a property with arguments.
member x.IsIndexer =
match x with
- | ILProp(_,ILPropInfo(_,pdef)) -> pdef.Args.Length <> 0
+ | ILProp(ILPropInfo(_,pdef)) -> pdef.Args.Length <> 0
| FSProp(g,_,Some vref,_) ->
// A getter has signature { OptionalObjectType } -> Unit -> PropertyType
// A getter indexer has signature { OptionalObjectType } -> TupledIndexerArguments -> PropertyType
@@ -2002,7 +2074,7 @@ type PropInfo =
/// Get the TcGlobals associated with the object
member x.TcGlobals =
match x with
- | ILProp(g,_) -> g
+ | ILProp ilpinfo -> ilpinfo.TcGlobals
| FSProp(g,_,_,_) -> g
#if !NO_EXTENSIONTYPING
| ProvidedProp(amap,_,_) -> amap.g
@@ -2011,13 +2083,13 @@ type PropInfo =
/// Indicates if the enclosing type for the property is a value type.
///
/// For an extension property, this indicates if the property extends a struct type.
- member x.IsValueType = isStructTy x.TcGlobals x.EnclosingType
+ member x.IsValueType = isStructTy x.TcGlobals x.ApparentEnclosingType
/// Get the result type of the property
member x.GetPropertyType (amap,m) =
match x with
- | ILProp (_,ilpinfo) -> ilpinfo.GetPropertyType (amap,m)
+ | ILProp ilpinfo -> ilpinfo.GetPropertyType (amap,m)
| FSProp (g,typ,Some vref,_)
| FSProp (g,typ,_,Some vref) ->
let inst = GetInstantiationForPropertyVal g (typ,vref)
@@ -2035,7 +2107,7 @@ type PropInfo =
/// If the property is in a generic type, then the type parameters are instantiated in the types returned.
member x.GetParamNamesAndTypes(amap,m) =
match x with
- | ILProp (_,ilpinfo) -> ilpinfo.GetParamNamesAndTypes(amap,m)
+ | ILProp ilpinfo -> ilpinfo.GetParamNamesAndTypes(amap,m)
| FSProp (g,typ,Some vref,_)
| FSProp (g,typ,_,Some vref) ->
let inst = GetInstantiationForPropertyVal g (typ,vref)
@@ -2061,7 +2133,7 @@ type PropInfo =
/// Get a MethInfo for the 'getter' method associated with the property
member x.GetterMethod =
match x with
- | ILProp(g,x) -> ILMeth(g,x.GetterMethod(g),None)
+ | ILProp ilpinfo -> ILMeth(x.TcGlobals, ilpinfo.GetterMethod, None)
| FSProp(g,typ,Some vref,_) -> FSMeth(g,typ,vref,None)
#if !NO_EXTENSIONTYPING
| ProvidedProp(amap,pi,m) ->
@@ -2074,7 +2146,7 @@ type PropInfo =
/// Get a MethInfo for the 'setter' method associated with the property
member x.SetterMethod =
match x with
- | ILProp(g,x) -> ILMeth(g,x.SetterMethod(g),None)
+ | ILProp ilpinfo -> ILMeth(x.TcGlobals, ilpinfo.SetterMethod, None)
| FSProp(g,typ,_,Some vref) -> FSMeth(g,typ,vref,None)
#if !NO_EXTENSIONTYPING
| ProvidedProp(amap,pi,m) ->
@@ -2092,7 +2164,7 @@ type PropInfo =
| None, None -> true
| _ -> false
match x1,x2 with
- | ILProp(_, x1), ILProp(_, x2) -> (x1.RawMetadata === x2.RawMetadata)
+ | ILProp ilpinfo1, ILProp ilpinfo2 -> (ilpinfo1.RawMetadata === ilpinfo2.RawMetadata)
| FSProp(g, _, vrefa1, vrefb1), FSProp(_, _, vrefa2, vrefb2) ->
(optVrefEq g (vrefa1, vrefa2)) && (optVrefEq g (vrefb1, vrefb2))
#if !NO_EXTENSIONTYPING
@@ -2103,7 +2175,7 @@ type PropInfo =
/// Calculates a hash code of property info (similar as previous)
member pi.ComputeHashCode() =
match pi with
- | ILProp(_, x1) -> hash x1.RawMetadata.Name
+ | ILProp ilpinfo -> hash ilpinfo.RawMetadata.Name
| FSProp(_,_,vrefOpt1, vrefOpt2) ->
// Hash on option*option
let vth = (vrefOpt1 |> Option.map (fun vr -> vr.LogicalName), (vrefOpt2 |> Option.map (fun vr -> vr.LogicalName)))
@@ -2121,21 +2193,32 @@ type PropInfo =
type ILEventInfo =
| ILEventInfo of ILTypeInfo * ILEventDef
+ /// Get the enclosing ("parent"/"declaring") type of the field.
+ member x.ApparentEnclosingType = match x with ILEventInfo(tinfo,_) -> tinfo.ToType
+
+ // Note: events are always associated with nominal types
+ member x.ApparentEnclosingAppType = x.ApparentEnclosingType
+
+ // Note: IL Events are never extension members as C# has no notion of extension events as yet
+ member x.DeclaringTyconRef = tcrefOfAppTy x.TcGlobals x.ApparentEnclosingAppType
+
+ member x.TcGlobals = match x with ILEventInfo(tinfo,_) -> tinfo.TcGlobals
+
/// Get the raw Abstract IL metadata for the event
- member x.RawMetadata = match x with (ILEventInfo(_,ed)) -> ed
+ member x.RawMetadata = match x with ILEventInfo(_,ed) -> ed
/// Get the declaring IL type of the event as an ILTypeInfo
- member x.ILTypeInfo = match x with (ILEventInfo(tinfo,_)) -> tinfo
+ member x.ILTypeInfo = match x with ILEventInfo(tinfo,_) -> tinfo
/// Get the ILMethInfo describing the 'add' method associated with the event
- member x.AddMethod(g) =
+ member x.AddMethod =
let mdef = resolveILMethodRef x.ILTypeInfo.RawMetadata x.RawMetadata.AddMethod
- ILMethInfo(g,x.ILTypeInfo.ToType,None,mdef,[])
+ ILMethInfo(x.TcGlobals,x.ILTypeInfo.ToType,None,mdef,[])
/// Get the ILMethInfo describing the 'remove' method associated with the event
- member x.RemoveMethod(g) =
+ member x.RemoveMethod =
let mdef = resolveILMethodRef x.ILTypeInfo.RawMetadata x.RawMetadata.RemoveMethod
- ILMethInfo(g,x.ILTypeInfo.ToType,None,mdef,[])
+ ILMethInfo(x.TcGlobals,x.ILTypeInfo.ToType,None,mdef,[])
/// Get the declaring type of the event as an ILTypeRef
member x.TypeRef = x.ILTypeInfo.ILTypeRef
@@ -2144,7 +2227,7 @@ type ILEventInfo =
member x.Name = x.RawMetadata.Name
/// Indicates if the property is static
- member x.IsStatic(g) = x.AddMethod(g).IsStatic
+ member x.IsStatic = x.AddMethod.IsStatic
override x.ToString() = x.ILTypeInfo.ToString() + "::" + x.Name
//-------------------------------------------------------------------------
@@ -2186,7 +2269,7 @@ type EventInfo =
/// An F# use of an event backed by F#-declared metadata
| FSEvent of TcGlobals * PropInfo * ValRef * ValRef
/// An F# use of an event backed by .NET metadata
- | ILEvent of TcGlobals * ILEventInfo
+ | ILEvent of ILEventInfo
#if !NO_EXTENSIONTYPING
/// An F# use of an event backed by provided metadata
| ProvidedEvent of Import.ImportMap * Tainted * range
@@ -2195,13 +2278,30 @@ type EventInfo =
/// Get the enclosing type of the event.
///
/// If this is an extension member, then this is the apparent parent, i.e. the type the event appears to extend.
- member x.EnclosingType =
+ member x.ApparentEnclosingType =
match x with
- | ILEvent(_,e) -> e.ILTypeInfo.ToType
- | FSEvent (_,p,_,_) -> p.EnclosingType
+ | ILEvent ileinfo -> ileinfo.ApparentEnclosingType
+ | FSEvent (_,p,_,_) -> p.ApparentEnclosingType
#if !NO_EXTENSIONTYPING
| ProvidedEvent (amap,ei,m) -> Import.ImportProvidedType amap m (ei.PApply((fun ei -> ei.DeclaringType),m))
#endif
+ /// Get the enclosing type of the method info, using a nominal type for tuple types
+ member x.ApparentEnclosingAppType =
+ match x with
+ | ILEvent ileinfo -> ileinfo.ApparentEnclosingAppType
+ | _ -> x.ApparentEnclosingType
+
+ member x.ApparentEnclosingTyconRef = tcrefOfAppTy x.TcGlobals x.ApparentEnclosingAppType
+
+ /// Get the declaring type or module holding the method.
+ /// Note that C#-style extension properties don't exist in the C# design as yet.
+ /// If this is an F#-style extension method it is the logical module
+ /// holding the value for the extension method.
+ member x.DeclaringTyconRef =
+ match x.ArbitraryValRef with
+ | Some vref when x.IsExtensionMember && vref.HasDeclaringEntity -> vref.TopValDeclaringEntity
+ | _ -> x.ApparentEnclosingTyconRef
+
/// Indicates if this event has an associated XML comment authored in this assembly.
member x.HasDirectXmlComment =
@@ -2225,7 +2325,7 @@ type EventInfo =
/// Get the logical name of the event.
member x.EventName =
match x with
- | ILEvent(_,e) -> e.Name
+ | ILEvent ileinfo -> ileinfo.Name
| FSEvent (_,p,_,_) -> p.PropertyName
#if !NO_EXTENSIONTYPING
| ProvidedEvent (_,ei,m) -> ei.PUntaint((fun ei -> ei.Name), m)
@@ -2234,7 +2334,7 @@ type EventInfo =
/// Indicates if this property is static.
member x.IsStatic =
match x with
- | ILEvent(g,e) -> e.IsStatic(g)
+ | ILEvent ileinfo -> ileinfo.IsStatic
| FSEvent (_,p,_,_) -> p.IsStatic
#if !NO_EXTENSIONTYPING
| ProvidedEvent (_,ei,m) ->
@@ -2242,10 +2342,19 @@ type EventInfo =
meth.PUntaint((fun mi -> mi.IsStatic), m)
#endif
+ /// Indicates if this is an extension member
+ member x.IsExtensionMember =
+ match x with
+ | ILEvent _ -> false
+ | FSEvent (_,p,_,_) -> p.IsExtensionMember
+#if !NO_EXTENSIONTYPING
+ | ProvidedEvent _ -> false
+#endif
+
/// Get the TcGlobals associated with the object
member x.TcGlobals =
match x with
- | ILEvent(g,_) -> g
+ | ILEvent ileinfo -> ileinfo.TcGlobals
| FSEvent(g,_,_,_) -> g
#if !NO_EXTENSIONTYPING
| ProvidedEvent (amap,_,_) -> amap.g
@@ -2254,13 +2363,13 @@ type EventInfo =
/// Indicates if the enclosing type for the event is a value type.
///
/// For an extension event, this indicates if the event extends a struct type.
- member x.IsValueType = isStructTy x.TcGlobals x.EnclosingType
+ member x.IsValueType = isStructTy x.TcGlobals x.ApparentEnclosingType
/// Get the 'add' method associated with an event
- member x.GetAddMethod() =
+ member x.AddMethod =
match x with
- | ILEvent(g,e) -> ILMeth(g,e.AddMethod(g),None)
- | FSEvent(g,p,addValRef,_) -> FSMeth(g,p.EnclosingType,addValRef,None)
+ | ILEvent ileinfo -> ILMeth(ileinfo.TcGlobals, ileinfo.AddMethod, None)
+ | FSEvent(g,p,addValRef,_) -> FSMeth(g,p.ApparentEnclosingType,addValRef,None)
#if !NO_EXTENSIONTYPING
| ProvidedEvent (amap,ei,m) ->
let meth = GetAndSanityCheckProviderMethod m ei (fun ei -> ei.GetAddMethod()) FSComp.SR.etEventNoAdd
@@ -2268,10 +2377,10 @@ type EventInfo =
#endif
/// Get the 'remove' method associated with an event
- member x.GetRemoveMethod() =
+ member x.RemoveMethod =
match x with
- | ILEvent(g,e) -> ILMeth(g,e.RemoveMethod(g),None)
- | FSEvent(g,p,_,removeValRef) -> FSMeth(g,p.EnclosingType,removeValRef,None)
+ | ILEvent ileinfo -> ILMeth(x.TcGlobals, ileinfo.RemoveMethod, None)
+ | FSEvent(g,p,_,removeValRef) -> FSMeth(g,p.ApparentEnclosingType,removeValRef,None)
#if !NO_EXTENSIONTYPING
| ProvidedEvent (amap,ei,m) ->
let meth = GetAndSanityCheckProviderMethod m ei (fun ei -> ei.GetRemoveMethod()) FSComp.SR.etEventNoRemove
@@ -2279,7 +2388,7 @@ type EventInfo =
#endif
/// Try to get an arbitrary F# ValRef associated with the member. This is to determine if the member is virtual, amongst other things.
- member x.ArbitraryValRef =
+ member x.ArbitraryValRef: ValRef option =
match x with
| FSEvent(_,_,addValRef,_) -> Some addValRef
| _ -> None
@@ -2287,11 +2396,11 @@ type EventInfo =
/// Get the delegate type associated with the event.
member x.GetDelegateType(amap,m) =
match x with
- | ILEvent(_,ILEventInfo(tinfo,edef)) ->
+ | ILEvent(ILEventInfo(tinfo,edef)) ->
// Get the delegate type associated with an IL event, taking into account the instantiation of the
// declaring type.
if Option.isNone edef.Type then error (nonStandardEventError x.EventName m)
- ImportILTypeFromMetadata amap m tinfo.ILScopeRef tinfo.TypeInst [] edef.Type.Value
+ ImportILTypeFromMetadata amap m tinfo.ILScopeRef tinfo.TypeInstOfRawMetadata [] edef.Type.Value
| FSEvent(g,p,_,_) ->
FindDelegateTypeOfPropertyEvent g amap x.EventName m (p.GetPropertyType(amap,m))
@@ -2306,7 +2415,7 @@ type EventInfo =
match x1, x2 with
| FSEvent(g, pi1, vrefa1, vrefb1), FSEvent(_, pi2, vrefa2, vrefb2) ->
PropInfo.PropInfosUseIdenticalDefinitions pi1 pi2 && valRefEq g vrefa1 vrefa2 && valRefEq g vrefb1 vrefb2
- | ILEvent(_, x1), ILEvent(_, x2) -> (x1.RawMetadata === x2.RawMetadata)
+ | ILEvent ileinfo1, ILEvent ileinfo2 -> (ileinfo1.RawMetadata === ileinfo2.RawMetadata)
#if !NO_EXTENSIONTYPING
| ProvidedEvent (_,ei1,_), ProvidedEvent (_,ei2,_) -> ProvidedEventInfo.TaintedEquals (ei1, ei2)
#endif
@@ -2315,7 +2424,7 @@ type EventInfo =
/// Calculates a hash code of event info (similar as previous)
member ei.ComputeHashCode() =
match ei with
- | ILEvent(_, x1) -> hash x1.RawMetadata.Name
+ | ILEvent ileinfo -> hash ileinfo.RawMetadata.Name
| FSEvent(_, pi, vref1, vref2) -> hash ( pi.ComputeHashCode(), vref1.LogicalName, vref2.LogicalName)
#if !NO_EXTENSIONTYPING
| ProvidedEvent (_,ei,_) -> ProvidedEventInfo.TaintedGetHashCode(ei)
@@ -2341,7 +2450,7 @@ let CompiledSigOfMeth g amap m (minfo:MethInfo) =
// of the enclosing type. For example, they may have constraints involving the _formal_ type parameters
// of the enclosing type. This instantiations can be used to interpret those type parameters
let fmtpinst =
- let parentTyArgs = argsOfAppTy g minfo.EnclosingType
+ let parentTyArgs = argsOfAppTy g minfo.ApparentEnclosingAppType
let memberParentTypars = minfo.GetFormalTyparsOfDeclaringType m
mkTyparInst memberParentTypars parentTyArgs
diff --git a/src/fsharp/service/ServiceAnalysis.fs b/src/fsharp/service/ServiceAnalysis.fs
index 5923459c031..d8b05a2d063 100644
--- a/src/fsharp/service/ServiceAnalysis.fs
+++ b/src/fsharp/service/ServiceAnalysis.fs
@@ -130,7 +130,7 @@ module UnusedOpens =
let usedByEnclosingEntity =
match symbolUse.Symbol with
| :? FSharpMemberOrFunctionOrValue as f ->
- match f.EnclosingEntity with
+ match f.DeclaringEntity with
| Some ent when ent.IsNamespace || ent.IsFSharpModule ->
Some (ent.IsEffectivelySameAs modul.Entity)
| _ -> None
diff --git a/src/fsharp/service/ServiceAssemblyContent.fs b/src/fsharp/service/ServiceAssemblyContent.fs
index 6020e59c787..f4a7ac416c3 100644
--- a/src/fsharp/service/ServiceAssemblyContent.fs
+++ b/src/fsharp/service/ServiceAssemblyContent.fs
@@ -88,7 +88,7 @@ module Extensions =
member x.TryGetFullCompiledOperatorNameIdents() : Idents option =
// For operator ++ displayName is ( ++ ) compiledName is op_PlusPlus
if isOperator x.DisplayName && x.DisplayName <> x.CompiledName then
- x.EnclosingEntity
+ x.DeclaringEntity
|> Option.bind (fun e -> e.TryGetFullName())
|> Option.map (fun enclosingEntityFullName ->
Array.append (enclosingEntityFullName.Split '.') [| x.CompiledName |])
diff --git a/src/fsharp/service/ServiceDeclarationLists.fs b/src/fsharp/service/ServiceDeclarationLists.fs
index 8fa9f7d4509..ce7291f55ed 100644
--- a/src/fsharp/service/ServiceDeclarationLists.fs
+++ b/src/fsharp/service/ServiceDeclarationLists.fs
@@ -560,9 +560,9 @@ type FSharpDeclarationListInfo(declarations: FSharpDeclarationListItem[], isForT
let items = items |> SymbolHelpers.RemoveExplicitlySuppressedCompletionItems g
let tyconRefOptEq tref1 tref2 =
- match tref1 with
- | Some tref1 -> tyconRefEq g tref1 tref2
- | None -> false
+ match tref1, tref2 with
+ | Some tref1, tref2 -> tyconRefEq g tref1 tref2
+ | _ -> false
// Adjust items priority. Sort by name. For things with the same name,
// - show types with fewer generic parameters first
@@ -576,10 +576,10 @@ type FSharpDeclarationListInfo(declarations: FSharpDeclarationListItem[], isForT
| Item.FakeInterfaceCtor (TType_app(tcref,_))
| Item.DelegateCtor (TType_app(tcref,_)) -> { x with MinorPriority = 1000 + tcref.TyparsNoRange.Length }
// Put type ctors after types, sorted by #typars. RemoveDuplicateItems will remove DefaultStructCtors if a type is also reported with this name
- | Item.CtorGroup (_, (cinfo :: _)) -> { x with MinorPriority = 1000 + 10 * (tcrefOfAppTy g cinfo.EnclosingType).TyparsNoRange.Length }
- | Item.MethodGroup(_, minfo :: _, _) -> { x with IsOwnMember = tyconRefOptEq x.Type minfo.DeclaringEntityRef }
- | Item.Property(_, pinfo :: _) -> { x with IsOwnMember = tyconRefOptEq x.Type (tcrefOfAppTy g pinfo.EnclosingType) }
- | Item.ILField finfo -> { x with IsOwnMember = tyconRefOptEq x.Type (tcrefOfAppTy g finfo.EnclosingType) }
+ | Item.CtorGroup (_, (cinfo :: _)) -> { x with MinorPriority = 1000 + 10 * cinfo.DeclaringTyconRef.TyparsNoRange.Length }
+ | Item.MethodGroup(_, minfo :: _, _) -> { x with IsOwnMember = tyconRefOptEq x.Type minfo.DeclaringTyconRef }
+ | Item.Property(_, pinfo :: _) -> { x with IsOwnMember = tyconRefOptEq x.Type pinfo.DeclaringTyconRef }
+ | Item.ILField finfo -> { x with IsOwnMember = tyconRefOptEq x.Type finfo.DeclaringTyconRef }
| _ -> x)
|> List.sortBy (fun x -> x.MinorPriority)
|> List.fold (fun (prevRealPrior, prevNormalizedPrior, acc) x ->
diff --git a/src/fsharp/service/ServiceInterfaceStubGenerator.fs b/src/fsharp/service/ServiceInterfaceStubGenerator.fs
index 4f62581f1bf..04b09ec157b 100644
--- a/src/fsharp/service/ServiceInterfaceStubGenerator.fs
+++ b/src/fsharp/service/ServiceInterfaceStubGenerator.fs
@@ -325,7 +325,7 @@ module internal InterfaceStubGenerator =
| _, true, _, name -> name + parArgs
// Ordinary functions or values
| false, _, _, name when
- not (Symbol.hasAttribute v.LogicalEnclosingEntity.Attributes) ->
+ not (Symbol.hasAttribute v.ApparentEnclosingEntity.Attributes) ->
name + " " + parArgs
// Ordinary static members or things (?) that require fully qualified access
| _, _, _, name -> name + parArgs
@@ -448,7 +448,7 @@ module internal InterfaceStubGenerator =
let internal (|TypeOfMember|_|) (m: FSharpMemberOrFunctionOrValue) =
match m.FullTypeSafe with
- | Some (MemberFunctionType typ) when m.IsProperty && m.EnclosingEntity.IsSome && m.EnclosingEntity.Value.IsFSharp ->
+ | Some (MemberFunctionType typ) when m.IsProperty && m.DeclaringEntity.IsSome && m.DeclaringEntity.Value.IsFSharp ->
Some typ
| Some typ -> Some typ
| None -> None
diff --git a/src/fsharp/service/service.fs b/src/fsharp/service/service.fs
index 1eff5163429..79610d4bee2 100644
--- a/src/fsharp/service/service.fs
+++ b/src/fsharp/service/service.fs
@@ -364,7 +364,7 @@ type TypeCheckInfo
let result =
match cnrs with
| CNR(_, Item.CtorGroup(_, ((ctor::_) as ctors)), _, denv, nenv, ad, m) ::_ ->
- let props = ResolveCompletionsInType ncenv nenv ResolveCompletionTargets.SettablePropertiesAndFields m ad false ctor.EnclosingType
+ let props = ResolveCompletionsInType ncenv nenv ResolveCompletionTargets.SettablePropertiesAndFields m ad false ctor.ApparentEnclosingType
let parameters = CollectParameters ctors amap m
let items = props @ parameters
Some (denv, m, items)
@@ -930,11 +930,11 @@ type TypeCheckInfo
scope.IsRelativeNameResolvable(cursorPos, plid, symbol.Item)
/// Get the auto-complete items at a location
- member __.GetDeclarations (ctok, parseResultsOpt, line, lineStr, partialName, getAllSymbols, hasTextChangedSinceLastTypecheck) =
+ member __.GetDeclarations (ctok, parseResultsOpt, line, lineStr, partialName, getAllEntities, hasTextChangedSinceLastTypecheck) =
let isInterfaceFile = SourceFileImpl.IsInterfaceFile mainInputFileName
ErrorScope.Protect Range.range0
(fun () ->
- match GetDeclItemsForNamesAtPosition(ctok, parseResultsOpt, Some partialName.QualifyingIdents, Some partialName.PartialIdent, partialName.LastDotPos, line, lineStr, partialName.EndColumn + 1, ResolveTypeNamesToCtors, ResolveOverloads.Yes, getAllSymbols, hasTextChangedSinceLastTypecheck) with
+ match GetDeclItemsForNamesAtPosition(ctok, parseResultsOpt, Some partialName.QualifyingIdents, Some partialName.PartialIdent, partialName.LastDotPos, line, lineStr, partialName.EndColumn + 1, ResolveTypeNamesToCtors, ResolveOverloads.Yes, getAllEntities, hasTextChangedSinceLastTypecheck) with
| None -> FSharpDeclarationListInfo.Empty
| Some (items, denv, ctx, m) ->
let items = if isInterfaceFile then items |> List.filter (fun x -> IsValidSignatureFileItem x.Item) else items
@@ -950,11 +950,11 @@ type TypeCheckInfo
FSharpDeclarationListInfo.Error msg)
/// Get the symbols for auto-complete items at a location
- member __.GetDeclarationListSymbols (ctok, parseResultsOpt, line, lineStr, partialName, hasTextChangedSinceLastTypecheck) =
+ member __.GetDeclarationListSymbols (ctok, parseResultsOpt, line, lineStr, partialName, getAllEntities, hasTextChangedSinceLastTypecheck) =
let isInterfaceFile = SourceFileImpl.IsInterfaceFile mainInputFileName
ErrorScope.Protect Range.range0
(fun () ->
- match GetDeclItemsForNamesAtPosition(ctok, parseResultsOpt, Some partialName.QualifyingIdents, Some partialName.PartialIdent, partialName.LastDotPos, line, lineStr, partialName.EndColumn + 1, ResolveTypeNamesToCtors, ResolveOverloads.Yes, (fun () -> []), hasTextChangedSinceLastTypecheck) with
+ match GetDeclItemsForNamesAtPosition(ctok, parseResultsOpt, Some partialName.QualifyingIdents, Some partialName.PartialIdent, partialName.LastDotPos, line, lineStr, partialName.EndColumn + 1, ResolveTypeNamesToCtors, ResolveOverloads.Yes, getAllEntities, hasTextChangedSinceLastTypecheck) with
| None -> List.Empty
| Some (items, denv, _, m) ->
let items = if isInterfaceFile then items |> List.filter (fun x -> IsValidSignatureFileItem x.Item) else items
@@ -966,7 +966,7 @@ type TypeCheckInfo
// - show types with fewer generic parameters first
// - show types before over other related items - they usually have very useful XmlDocs
let items =
- items |> List.sortBy (fun d ->
+ items |> List.sortBy (fun d ->
let n =
match d.Item with
| Item.Types (_,(TType_app(tcref,_) :: _)) -> 1 + tcref.TyparsNoRange.Length
@@ -974,15 +974,26 @@ type TypeCheckInfo
| Item.FakeInterfaceCtor (TType_app(tcref,_))
| Item.DelegateCtor (TType_app(tcref,_)) -> 1000 + tcref.TyparsNoRange.Length
// Put type ctors after types, sorted by #typars. RemoveDuplicateItems will remove DefaultStructCtors if a type is also reported with this name
- | Item.CtorGroup (_, (cinfo :: _)) -> 1000 + 10 * (tcrefOfAppTy g cinfo.EnclosingType).TyparsNoRange.Length
+ | Item.CtorGroup (_, (cinfo :: _)) -> 1000 + 10 * cinfo.DeclaringTyconRef.TyparsNoRange.Length
| _ -> 0
(d.Item.DisplayName,n))
// Remove all duplicates. We've put the types first, so this removes the DelegateCtor and DefaultStructCtor's.
let items = items |> RemoveDuplicateCompletionItems g
- // Group by display name
- let items = items |> List.groupBy (fun d -> d.Item.DisplayName)
+ // Group by compiled name for types, display name for functions
+ // (We don't want types with the same display name to be grouped as overloads)
+ let items =
+ items |> List.groupBy (fun d ->
+ match d.Item with
+ | Item.Types (_,(TType_app(tcref,_) :: _))
+ | Item.ExnCase tcref -> tcref.LogicalName
+ | Item.UnqualifiedType(tcref :: _)
+ | Item.FakeInterfaceCtor (TType_app(tcref,_))
+ | Item.DelegateCtor (TType_app(tcref,_)) -> tcref.CompiledName
+ | Item.CtorGroup (_, (cinfo :: _)) ->
+ (tcrefOfAppTy g cinfo.ApparentEnclosingType).CompiledName
+ | _ -> d.Item.DisplayName)
// Filter out operators (and list)
let items =
@@ -1149,7 +1160,7 @@ type TypeCheckInfo
let typeVarNames = getTypeVarNames ilinfo
ParamTypeSymbol.tryOfILTypes typeVarNames ilinfo.ILMethodRef.ArgTypes
|> Option.map (fun args ->
- let externalSym = ExternalSymbol.Constructor (ilinfo.ILMethodRef.EnclosingTypeRef.FullName, args)
+ let externalSym = ExternalSymbol.Constructor (ilinfo.ILMethodRef.DeclaringTypeRef.FullName, args)
FSharpFindDeclResult.ExternalDecl (assref.Name, externalSym))
| _ -> None
@@ -1159,33 +1170,33 @@ type TypeCheckInfo
let typeVarNames = getTypeVarNames ilinfo
ParamTypeSymbol.tryOfILTypes typeVarNames ilinfo.ILMethodRef.ArgTypes
|> Option.map (fun args ->
- let externalSym = ExternalSymbol.Method (ilinfo.ILMethodRef.EnclosingTypeRef.FullName, name, args, ilinfo.ILMethodRef.GenericArity)
+ let externalSym = ExternalSymbol.Method (ilinfo.ILMethodRef.DeclaringTypeRef.FullName, name, args, ilinfo.ILMethodRef.GenericArity)
FSharpFindDeclResult.ExternalDecl (assref.Name, externalSym))
| _ -> None
- | Item.Property (name, ILProp (_, propInfo) :: _) ->
+ | Item.Property (name, ILProp propInfo :: _) ->
let methInfo =
- if propInfo.HasGetter then Some (propInfo.GetterMethod g)
- elif propInfo.HasSetter then Some (propInfo.SetterMethod g)
+ if propInfo.HasGetter then Some propInfo.GetterMethod
+ elif propInfo.HasSetter then Some propInfo.SetterMethod
else None
match methInfo with
| Some methInfo ->
match methInfo.MetadataScope with
| ILScopeRef.Assembly assref ->
- let externalSym = ExternalSymbol.Property (methInfo.ILMethodRef.EnclosingTypeRef.FullName, name)
+ let externalSym = ExternalSymbol.Property (methInfo.ILMethodRef.DeclaringTypeRef.FullName, name)
Some (FSharpFindDeclResult.ExternalDecl (assref.Name, externalSym))
| _ -> None
| None -> None
- | Item.ILField (ILFieldInfo (ILTypeInfo (tr, _, _, _) & typeInfo, fieldDef)) when not tr.IsLocalRef ->
+ | Item.ILField (ILFieldInfo (typeInfo, fieldDef)) when not typeInfo.TyconRefOfRawMetadata.IsLocalRef ->
match typeInfo.ILScopeRef with
| ILScopeRef.Assembly assref ->
let externalSym = ExternalSymbol.Field (typeInfo.ILTypeRef.FullName, fieldDef.Name)
Some (FSharpFindDeclResult.ExternalDecl (assref.Name, externalSym))
| _ -> None
- | Item.Event (ILEvent (_, ILEventInfo (ILTypeInfo (tr, _, _, _) & typeInfo, eventDef))) when not tr.IsLocalRef ->
+ | Item.Event (ILEvent (ILEventInfo (typeInfo, eventDef))) when not typeInfo.TyconRefOfRawMetadata.IsLocalRef ->
match typeInfo.ILScopeRef with
| ILScopeRef.Assembly assref ->
let externalSym = ExternalSymbol.Event (typeInfo.ILTypeRef.FullName, eventDef.Name)
@@ -1353,7 +1364,7 @@ type TypeCheckInfo
Some (m, SemanticClassificationType.ValueType)
else Some (m, SemanticClassificationType.ReferenceType)
| CNR(_, Item.CtorGroup(_, minfos), LegitTypeOccurence, _, _, _, m) ->
- if minfos |> List.exists (fun minfo -> isStructTy g minfo.EnclosingType) then
+ if minfos |> List.exists (fun minfo -> isStructTy g minfo.ApparentEnclosingType) then
Some (m, SemanticClassificationType.ValueType)
else Some (m, SemanticClassificationType.ReferenceType)
| CNR(_, Item.ExnCase _, LegitTypeOccurence, _, _, _, m) ->
@@ -1519,6 +1530,10 @@ module internal Parser =
if source.Length = 0 || not (source.[source.Length - 1] = '\n') then source + "\n" else source
let matchBraces(source, fileName, options: FSharpParsingOptions, userOpName: string) =
+ let delayedLogger = CapturingErrorLogger("matchBraces")
+ use _unwindEL = PushErrorLoggerPhaseUntilUnwind (fun _ -> delayedLogger)
+ use _unwindBP = PushThreadBuildPhaseUntilUnwind BuildPhase.Parse
+
Trace.TraceInformation("FCS: {0}.{1} ({2})", userOpName, "matchBraces", fileName)
// Make sure there is an ErrorLogger installed whenever we do stuff that might record errors, even if we ultimately ignore the errors
@@ -1945,16 +1960,18 @@ type FSharpCheckFileResults(filename: string, errors: FSharpErrorInfo[], scopeOp
member info.HasFullTypeCheckInfo = details.IsSome
/// Intellisense autocompletions
- member info.GetDeclarationListInfo(parseResultsOpt, line, lineStr, partialName, getAllEntities, ?hasTextChangedSinceLastTypecheck, ?userOpName: string) =
+ member info.GetDeclarationListInfo(parseResultsOpt, line, lineStr, partialName, ?getAllEntities, ?hasTextChangedSinceLastTypecheck, ?userOpName: string) =
let userOpName = defaultArg userOpName "Unknown"
+ let getAllEntities = defaultArg getAllEntities (fun() -> [])
let hasTextChangedSinceLastTypecheck = defaultArg hasTextChangedSinceLastTypecheck (fun _ -> false)
reactorOp userOpName "GetDeclarations" FSharpDeclarationListInfo.Empty (fun ctok scope ->
scope.GetDeclarations(ctok, parseResultsOpt, line, lineStr, partialName, getAllEntities, hasTextChangedSinceLastTypecheck))
- member info.GetDeclarationListSymbols(parseResultsOpt, line, lineStr, partialName, ?hasTextChangedSinceLastTypecheck, ?userOpName: string) =
+ member info.GetDeclarationListSymbols(parseResultsOpt, line, lineStr, partialName, ?getAllEntities, ?hasTextChangedSinceLastTypecheck, ?userOpName: string) =
let userOpName = defaultArg userOpName "Unknown"
let hasTextChangedSinceLastTypecheck = defaultArg hasTextChangedSinceLastTypecheck (fun _ -> false)
- reactorOp userOpName "GetDeclarationListSymbols" List.empty (fun ctok scope -> scope.GetDeclarationListSymbols(ctok, parseResultsOpt, line, lineStr, partialName, hasTextChangedSinceLastTypecheck))
+ let getAllEntities = defaultArg getAllEntities (fun() -> [])
+ reactorOp userOpName "GetDeclarationListSymbols" List.empty (fun ctok scope -> scope.GetDeclarationListSymbols(ctok, parseResultsOpt, line, lineStr, partialName, getAllEntities, hasTextChangedSinceLastTypecheck))
/// Resolve the names at the given location to give a data tip
member info.GetStructuredToolTipText(line, colAtEndOfNames, lineStr, names, tokenTag, ?userOpName: string) =
diff --git a/src/fsharp/service/service.fsi b/src/fsharp/service/service.fsi
index 423b74e21bf..82a1a563ea8 100755
--- a/src/fsharp/service/service.fsi
+++ b/src/fsharp/service/service.fsi
@@ -119,8 +119,8 @@ type public FSharpCheckFileResults =
/// The text of the line where the completion is happening. This is only used to make a couple
/// of adhoc corrections to completion accuracy (e.g. checking for "..")
///
- ///
- /// Function that returns all symbols from current and referenced assemblies.
+ ///
+ /// Function that returns all entities from current and referenced assemblies.
///
///
/// If text has been used from a captured name resolution from the typecheck, then
@@ -128,7 +128,7 @@ type public FSharpCheckFileResults =
/// and assume that we're going to repeat the operation later on.
///
/// An optional string used for tracing compiler operations associated with this request.
- member GetDeclarationListInfo : ParsedFileResultsOpt:FSharpParseFileResults option * line: int * lineText:string * partialName: PartialLongName * getAllSymbols: (unit -> AssemblySymbol list) * ?hasTextChangedSinceLastTypecheck: (obj * range -> bool) * ?userOpName: string -> Async
+ member GetDeclarationListInfo : ParsedFileResultsOpt:FSharpParseFileResults option * line: int * lineText:string * partialName: PartialLongName * ?getAllEntities: (unit -> AssemblySymbol list) * ?hasTextChangedSinceLastTypecheck: (obj * range -> bool) * ?userOpName: string -> Async
/// Get the items for a declaration list in FSharpSymbol format
///
@@ -145,8 +145,8 @@ type public FSharpCheckFileResults =
/// The text of the line where the completion is happening. This is only used to make a couple
/// of adhoc corrections to completion accuracy (e.g. checking for "..")
///
- ///
- /// Function that returns all symbols from current and referenced assemblies.
+ ///
+ /// Function that returns all entities from current and referenced assemblies.
///
///
/// If text has been used from a captured name resolution from the typecheck, then
@@ -154,7 +154,7 @@ type public FSharpCheckFileResults =
/// and assume that we're going to repeat the operation later on.
///
/// An optional string used for tracing compiler operations associated with this request.
- member GetDeclarationListSymbols : ParsedFileResultsOpt:FSharpParseFileResults option * line: int * lineText:string * partialName: PartialLongName * ?hasTextChangedSinceLastTypecheck: (obj * range -> bool) * ?userOpName: string -> Async
+ member GetDeclarationListSymbols : ParsedFileResultsOpt:FSharpParseFileResults option * line: int * lineText:string * partialName: PartialLongName * ?getAllEntities: (unit -> AssemblySymbol list) * ?hasTextChangedSinceLastTypecheck: (obj * range -> bool) * ?userOpName: string -> Async
/// Compute a formatted tooltip for the given location
diff --git a/src/fsharp/symbols/Exprs.fs b/src/fsharp/symbols/Exprs.fs
index 5a39e3c8491..ba5c1872438 100644
--- a/src/fsharp/symbols/Exprs.fs
+++ b/src/fsharp/symbols/Exprs.fs
@@ -582,22 +582,22 @@ module FSharpExprConvert =
E.TupleGet(tyR, n, ConvExpr cenv env e)
| TOp.ILAsm([ I_ldfld(_, _, fspec) ], _), enclTypeArgs, [obj] ->
- let typR = ConvILTypeRefApp cenv m fspec.EnclosingTypeRef enclTypeArgs
+ let typR = ConvILTypeRefApp cenv m fspec.DeclaringTypeRef enclTypeArgs
let objR = ConvLValueExpr cenv env obj
E.ILFieldGet(Some objR, typR, fspec.Name)
| TOp.ILAsm(( [ I_ldsfld (_, fspec) ] | [ I_ldsfld (_, fspec); AI_nop ]), _), enclTypeArgs, [] ->
- let typR = ConvILTypeRefApp cenv m fspec.EnclosingTypeRef enclTypeArgs
+ let typR = ConvILTypeRefApp cenv m fspec.DeclaringTypeRef enclTypeArgs
E.ILFieldGet(None, typR, fspec.Name)
| TOp.ILAsm([ I_stfld(_, _, fspec) ], _), enclTypeArgs, [obj;arg] ->
- let typR = ConvILTypeRefApp cenv m fspec.EnclosingTypeRef enclTypeArgs
+ let typR = ConvILTypeRefApp cenv m fspec.DeclaringTypeRef enclTypeArgs
let objR = ConvLValueExpr cenv env obj
let argR = ConvExpr cenv env arg
E.ILFieldSet(Some objR, typR, fspec.Name, argR)
| TOp.ILAsm([ I_stsfld(_, fspec) ], _), enclTypeArgs, [arg] ->
- let typR = ConvILTypeRefApp cenv m fspec.EnclosingTypeRef enclTypeArgs
+ let typR = ConvILTypeRefApp cenv m fspec.DeclaringTypeRef enclTypeArgs
let argR = ConvExpr cenv env arg
E.ILFieldSet(None, typR, fspec.Name, argR)
@@ -617,14 +617,14 @@ module FSharpExprConvert =
ConvExprPrim cenv env op
| TOp.ILAsm ([ I_call (Normalcall, mspec, None) ], _), _, [arg]
- when mspec.MethodRef.EnclosingTypeRef.Name = "System.String" && mspec.Name = "GetHashCode" ->
+ when mspec.MethodRef.DeclaringTypeRef.Name = "System.String" && mspec.Name = "GetHashCode" ->
let ty = tyOfExpr cenv.g arg
let op = mkCallHash cenv.g m ty arg
ConvExprPrim cenv env op
| TOp.ILCall(_, _, _, _, _, _, _, mref, _, _, _), [],
[Expr.Op(TOp.ILAsm([ I_ldtoken (ILToken.ILType _) ], _), [ty], _, _)]
- when mref.EnclosingTypeRef.Name = "System.Type" && mref.Name = "GetTypeFromHandle" ->
+ when mref.DeclaringTypeRef.Name = "System.Type" && mref.Name = "GetTypeFromHandle" ->
let op = mkCallTypeOf cenv.g m ty
ConvExprPrim cenv env op
@@ -835,9 +835,9 @@ module FSharpExprConvert =
// this does not matter currently, type checking fails to resolve it when a TP references a union case subclass
try
// if the type is an union case class, lookup will fail
- Import.ImportILTypeRef cenv.amap m ilMethRef.EnclosingTypeRef, None
+ Import.ImportILTypeRef cenv.amap m ilMethRef.DeclaringTypeRef, None
with _ ->
- let e = ilMethRef.EnclosingTypeRef
+ let e = ilMethRef.DeclaringTypeRef
let parent = ILTypeRef.Create(e.Scope, e.Enclosing.Tail, e.Enclosing.Head)
Import.ImportILTypeRef cenv.amap m parent, Some e.Name
@@ -877,7 +877,7 @@ module FSharpExprConvert =
enclosingEntity.ModuleOrNamespaceType.AllValsAndMembers
|> Seq.filter (fun v ->
v.CompiledName = vName &&
- match v.ActualParent with
+ match v.DeclaringEntity with
| Parent p -> p.PublicPath = enclosingEntity.PublicPath
| _ -> false
) |> List.ofSeq
@@ -984,7 +984,7 @@ module FSharpExprConvert =
let logicalName = ilMethRef.Name
let isMember = memberParentName.IsSome
if isMember then
- match ilMethRef.Name, ilMethRef.EnclosingTypeRef.Name with
+ match ilMethRef.Name, ilMethRef.DeclaringTypeRef.Name with
| "Invoke", "Microsoft.FSharp.Core.FSharpFunc`2" ->
let objR = ConvLValueExpr cenv env callArgs.Head
let argR = ConvExpr cenv env callArgs.Tail.Head
@@ -993,7 +993,7 @@ module FSharpExprConvert =
| _ ->
let isCtor = (ilMethRef.Name = ".ctor")
let isStatic = isCtor || ilMethRef.CallingConv.IsStatic
- let scoref = ilMethRef.EnclosingTypeRef.Scope
+ let scoref = ilMethRef.DeclaringTypeRef.Scope
let typars1 = tcref.Typars(m)
let typars2 = [ 1 .. ilMethRef.GenericArity ] |> List.map (fun _ -> NewRigidTypar "T" m)
let tinst1 = typars1 |> generalizeTypars
diff --git a/src/fsharp/symbols/SymbolHelpers.fs b/src/fsharp/symbols/SymbolHelpers.fs
index c13731306dd..a2997654b74 100644
--- a/src/fsharp/symbols/SymbolHelpers.fs
+++ b/src/fsharp/symbols/SymbolHelpers.fs
@@ -393,7 +393,7 @@ module internal SymbolHelpers =
| _ ->
minfo.ArbitraryValRef
|> Option.bind ccuOfValRef
- |> Option.orElseWith (fun () -> minfo.DeclaringEntityRef |> computeCcuOfTyconRef)
+ |> Option.orElseWith (fun () -> minfo.DeclaringTyconRef |> computeCcuOfTyconRef)
let rec ccuOfItem (g:TcGlobals) d =
@@ -403,13 +403,13 @@ module internal SymbolHelpers =
| Item.ActivePatternCase apref -> ccuOfValRef apref.ActivePatternVal
| Item.ExnCase tcref -> computeCcuOfTyconRef tcref
| Item.RecdField rfinfo -> computeCcuOfTyconRef rfinfo.RecdFieldRef.TyconRef
- | Item.Event einfo -> einfo.EnclosingType |> tcrefOfAppTy g |> computeCcuOfTyconRef
- | Item.ILField finfo -> finfo.EnclosingType |> tcrefOfAppTy g |> computeCcuOfTyconRef
+ | Item.Event einfo -> einfo.DeclaringTyconRef |> computeCcuOfTyconRef
+ | Item.ILField finfo -> finfo.DeclaringTyconRef |> computeCcuOfTyconRef
| Item.Property(_, pinfos) ->
pinfos |> List.tryPick (fun pinfo ->
pinfo.ArbitraryValRef
|> Option.bind ccuOfValRef
- |> Option.orElseWith (fun () -> pinfo.EnclosingType |> tcrefOfAppTy g |> computeCcuOfTyconRef))
+ |> Option.orElseWith (fun () -> pinfo.DeclaringTyconRef |> computeCcuOfTyconRef))
| Item.ArgName (_, _, Some (ArgumentContainer.Method minfo)) -> ccuOfMethInfo g minfo
@@ -498,8 +498,8 @@ module internal SymbolHelpers =
let GetXmlDocSigOfScopedValRef g (tcref:TyconRef) (vref:ValRef) =
let ccuFileName = libFileOfEntityRef tcref
let v = vref.Deref
- if v.XmlDocSig = "" && v.HasTopValActualParent then
- v.XmlDocSig <- XmlDocSigOfVal g (buildAccessPath vref.TopValActualParent.CompilationPathOpt) v
+ if v.XmlDocSig = "" && v.HasDeclaringEntity then
+ v.XmlDocSig <- XmlDocSigOfVal g (buildAccessPath vref.TopValDeclaringEntity.CompilationPathOpt) v
Some (ccuFileName, v.XmlDocSig)
let GetXmlDocSigOfRecdFieldInfo (rfinfo:RecdFieldInfo) =
@@ -520,7 +520,7 @@ module internal SymbolHelpers =
let amap = infoReader.amap
match minfo with
| FSMeth (g, _, vref, _) ->
- GetXmlDocSigOfScopedValRef g minfo.DeclaringEntityRef vref
+ GetXmlDocSigOfScopedValRef g minfo.DeclaringTyconRef vref
| ILMeth (g, ilminfo, _) ->
let actualTypeName = ilminfo.DeclaringTyconRef.CompiledRepresentationForNamedType.FullName
let fmtps = ilminfo.FormalMethodTypars
@@ -549,25 +549,24 @@ module internal SymbolHelpers =
if not vref.IsLocalRef then
let ccuFileName = vref.nlr.Ccu.FileName
let v = vref.Deref
- if v.XmlDocSig = "" && v.HasTopValActualParent then
- v.XmlDocSig <- XmlDocSigOfVal g vref.TopValActualParent.CompiledRepresentationForNamedType.Name v
+ if v.XmlDocSig = "" && v.HasDeclaringEntity then
+ v.XmlDocSig <- XmlDocSigOfVal g vref.TopValDeclaringEntity.CompiledRepresentationForNamedType.Name v
Some (ccuFileName, v.XmlDocSig)
else
None
- let GetXmlDocSigOfProp infoReader m pinfo =
+ let GetXmlDocSigOfProp infoReader m (pinfo: PropInfo) =
+ let g = pinfo.TcGlobals
match pinfo with
#if !NO_EXTENSIONTYPING
| ProvidedProp _ -> None // No signature is possible. If an xml comment existed it would have been returned by PropInfo.XmlDoc in infos.fs
#endif
- | FSProp (g, typ, _, _) as fspinfo ->
- let tcref = tcrefOfAppTy g typ
+ | FSProp _ as fspinfo ->
match fspinfo.ArbitraryValRef with
| None -> None
- | Some vref -> GetXmlDocSigOfScopedValRef g tcref vref
- | ILProp(g, (ILPropInfo(tinfo, pdef))) ->
- let tcref = tinfo.TyconRef
- match metaInfoOfEntityRef infoReader m tcref with
+ | Some vref -> GetXmlDocSigOfScopedValRef g pinfo.DeclaringTyconRef vref
+ | ILProp(ILPropInfo(_, pdef)) ->
+ match metaInfoOfEntityRef infoReader m pinfo.DeclaringTyconRef with
| Some (ccuFileName, formalTypars, formalTypeInfo) ->
let filpinfo = ILPropInfo(formalTypeInfo, pdef)
Some (ccuFileName, "P:"+formalTypeInfo.ILTypeRef.FullName+"."+pdef.Name+XmlDocArgsEnc g (formalTypars, []) (filpinfo.GetParamTypes(infoReader.amap, m)))
@@ -575,17 +574,15 @@ module internal SymbolHelpers =
let GetXmlDocSigOfEvent infoReader m (einfo:EventInfo) =
match einfo with
- | ILEvent(_, ilEventInfo) ->
- let tinfo = ilEventInfo.ILTypeInfo
- let tcref = tinfo.TyconRef
- match metaInfoOfEntityRef infoReader m tcref with
+ | ILEvent _ ->
+ match metaInfoOfEntityRef infoReader m einfo.DeclaringTyconRef with
| Some (ccuFileName, _, formalTypeInfo) ->
Some(ccuFileName, "E:"+formalTypeInfo.ILTypeRef.FullName+"."+einfo.EventName)
| _ -> None
| _ -> None
let GetXmlDocSigOfILFieldInfo infoReader m (finfo:ILFieldInfo) =
- match metaInfoOfEntityRef infoReader m (tcrefOfAppTy infoReader.g finfo.EnclosingType) with
+ match metaInfoOfEntityRef infoReader m finfo.DeclaringTyconRef with
| Some (ccuFileName, _, formalTypeInfo) ->
Some(ccuFileName, "F:"+formalTypeInfo.ILTypeRef.FullName+"."+finfo.FieldName)
| _ -> None
@@ -706,7 +703,7 @@ module internal SymbolHelpers =
// This may explore assemblies that are not in the reference set.
// In this case just bail out and assume items are not equal
protectAssemblyExploration false (fun () ->
- let equalTypes(ty1, ty2) =
+ let equalHeadTypes(ty1, ty2) =
if isAppTy g ty1 && isAppTy g ty2 then tyconRefEq g (tcrefOfAppTy g ty1) (tcrefOfAppTy g ty2)
else typeEquiv g ty1 ty2
@@ -714,13 +711,13 @@ module internal SymbolHelpers =
// Much of this logic is already covered by 'ItemsAreEffectivelyEqual'
match item1, item2 with
- | Item.DelegateCtor(ty1), Item.DelegateCtor(ty2) -> equalTypes(ty1, ty2)
+ | Item.DelegateCtor(ty1), Item.DelegateCtor(ty2) -> equalHeadTypes(ty1, ty2)
| Item.Types(dn1, [ty1]), Item.Types(dn2, [ty2]) ->
// Bug 4403: We need to compare names as well, because 'int' and 'Int32' are physically the same type, but we want to show both
- dn1 = dn2 && equalTypes(ty1, ty2)
+ dn1 = dn2 && equalHeadTypes(ty1, ty2)
// Prefer a type to a DefaultStructCtor, a DelegateCtor and a FakeInterfaceCtor
- | ItemWhereTypIsPreferred(ty1), ItemWhereTypIsPreferred(ty2) -> equalTypes(ty1, ty2)
+ | ItemWhereTypIsPreferred(ty1), ItemWhereTypIsPreferred(ty2) -> equalHeadTypes(ty1, ty2)
| Item.ExnCase(tcref1), Item.ExnCase(tcref2) -> tyconRefEq g tcref1 tcref2
| Item.ILField(ILFieldInfo(_, fld1)), Item.ILField(ILFieldInfo(_, fld2)) ->
@@ -823,7 +820,7 @@ module internal SymbolHelpers =
| Item.Types(it, [ty]) ->
g.suppressed_types
|> List.exists (fun supp ->
- if isAppTy g ty then
+ if isAppTy g ty && isAppTy g (generalizedTyconRef supp) then
// check if they are the same logical type (after removing all abbreviations)
let tcr1 = tcrefOfAppTy g ty
let tcr2 = tcrefOfAppTy g (generalizedTyconRef supp)
@@ -861,12 +858,12 @@ module internal SymbolHelpers =
| Item.RecdField rfinfo -> fullDisplayTextOfRecdFieldRef rfinfo.RecdFieldRef
| Item.NewDef id -> id.idText
| Item.ILField finfo -> bufs (fun os -> NicePrint.outputILTypeRef denv os finfo.ILTypeRef; bprintf os ".%s" finfo.FieldName)
- | Item.Event einfo -> bufs (fun os -> NicePrint.outputTyconRef denv os (tcrefOfAppTy g einfo.EnclosingType); bprintf os ".%s" einfo.EventName)
- | Item.Property(_, (pinfo::_)) -> bufs (fun os -> NicePrint.outputTyconRef denv os (tcrefOfAppTy g pinfo.EnclosingType); bprintf os ".%s" pinfo.PropertyName)
+ | Item.Event einfo -> bufs (fun os -> NicePrint.outputTyconRef denv os einfo.DeclaringTyconRef; bprintf os ".%s" einfo.EventName)
+ | Item.Property(_, (pinfo::_)) -> bufs (fun os -> NicePrint.outputTyconRef denv os pinfo.DeclaringTyconRef; bprintf os ".%s" pinfo.PropertyName)
| Item.CustomOperation (customOpName, _, _) -> customOpName
- | Item.CtorGroup(_, minfo :: _) -> bufs (fun os -> NicePrint.outputTyconRef denv os minfo.DeclaringEntityRef)
- | Item.MethodGroup(_, _, Some minfo) -> bufs (fun os -> NicePrint.outputTyconRef denv os minfo.DeclaringEntityRef; bprintf os ".%s" minfo.DisplayName)
- | Item.MethodGroup(_, minfo :: _, _) -> bufs (fun os -> NicePrint.outputTyconRef denv os minfo.DeclaringEntityRef; bprintf os ".%s" minfo.DisplayName)
+ | Item.CtorGroup(_, minfo :: _) -> bufs (fun os -> NicePrint.outputTyconRef denv os minfo.DeclaringTyconRef)
+ | Item.MethodGroup(_, _, Some minfo) -> bufs (fun os -> NicePrint.outputTyconRef denv os minfo.DeclaringTyconRef; bprintf os ".%s" minfo.DisplayName)
+ | Item.MethodGroup(_, minfo :: _, _) -> bufs (fun os -> NicePrint.outputTyconRef denv os minfo.DeclaringTyconRef; bprintf os ".%s" minfo.DisplayName)
| Item.UnqualifiedType (tcref :: _) -> bufs (fun os -> NicePrint.outputTyconRef denv os tcref)
| Item.FakeInterfaceCtor typ
| Item.DelegateCtor typ
@@ -1082,7 +1079,7 @@ module internal SymbolHelpers =
let rty, _cxs = PrettyTypes.PrettifyType g rty
let layout =
wordL (tagText (FSComp.SR.typeInfoEvent())) ^^
- NicePrint.layoutTyconRef denv (tcrefOfAppTy g einfo.EnclosingType) ^^
+ NicePrint.layoutTyconRef denv einfo.ApparentEnclosingTyconRef ^^
SepL.dot ^^
wordL (tagEvent einfo.EventName) ^^
RightL.colon ^^
@@ -1113,7 +1110,7 @@ module internal SymbolHelpers =
) ^^
SepL.lineBreak ^^ SepL.lineBreak ^^
wordL (tagText (FSComp.SR.typeInfoCallsWord())) ^^
- NicePrint.layoutTyconRef denv (tcrefOfAppTy g minfo.EnclosingType) ^^
+ NicePrint.layoutTyconRef denv minfo.ApparentEnclosingTyconRef ^^
SepL.dot ^^
wordL (tagMethod minfo.DisplayName)
@@ -1273,7 +1270,7 @@ module internal SymbolHelpers =
let getKeywordForMethInfo (minfo : MethInfo) =
match minfo with
| FSMeth(_, _, vref, _) ->
- match vref.ActualParent with
+ match vref.DeclaringEntity with
| Parent tcref ->
(tcref |> ticksAndArgCountTextOfTyconRef)+"."+vref.CompiledName|> Some
| ParentNone -> None
@@ -1293,8 +1290,8 @@ module internal SymbolHelpers =
match item with
| Item.Value vref | Item.CustomBuilder (_, vref) ->
let v = vref.Deref
- if v.IsModuleBinding && v.HasTopValActualParent then
- let tyconRef = v.TopValActualParent
+ if v.IsModuleBinding && v.HasDeclaringEntity then
+ let tyconRef = v.TopValDeclaringEntity
let paramsString =
match v.Typars with
| [] -> ""
@@ -1316,7 +1313,7 @@ module internal SymbolHelpers =
| Item.ILField finfo ->
match finfo with
| ILFieldInfo(tinfo, fdef) ->
- (tinfo.TyconRef |> ticksAndArgCountTextOfTyconRef)+"."+fdef.Name |> Some
+ (tinfo.TyconRefOfRawMetadata |> ticksAndArgCountTextOfTyconRef)+"."+fdef.Name |> Some
#if !NO_EXTENSIONTYPING
| ProvidedField _ -> None
#endif
@@ -1362,13 +1359,13 @@ module internal SymbolHelpers =
| FSProp(_, _, Some vref, _)
| FSProp(_, _, _, Some vref) ->
// per spec, extension members in F1 keywords are qualified with definition class
- match vref.ActualParent with
+ match vref.DeclaringEntity with
| Parent tcref ->
(tcref |> ticksAndArgCountTextOfTyconRef)+"."+vref.PropertyName|> Some
| ParentNone -> None
- | ILProp(_, (ILPropInfo(tinfo, pdef))) ->
- let tcref = tinfo.TyconRef
+ | ILProp(ILPropInfo(tinfo, pdef)) ->
+ let tcref = tinfo.TyconRefOfRawMetadata
(tcref |> ticksAndArgCountTextOfTyconRef)+"."+pdef.Name |> Some
| FSProp _ -> None
#if !NO_EXTENSIONTYPING
@@ -1378,15 +1375,14 @@ module internal SymbolHelpers =
| Item.Event einfo ->
match einfo with
- | ILEvent(_, ilEventInfo) ->
- let tinfo = ilEventInfo.ILTypeInfo
- let tcref = tinfo.TyconRef
+ | ILEvent _ ->
+ let tcref = einfo.DeclaringTyconRef
(tcref |> ticksAndArgCountTextOfTyconRef)+"."+einfo.EventName |> Some
| FSEvent(_, pinfo, _, _) ->
match pinfo.ArbitraryValRef with
| Some vref ->
// per spec, members in F1 keywords are qualified with definition class
- match vref.ActualParent with
+ match vref.DeclaringEntity with
| Parent tcref -> (tcref |> ticksAndArgCountTextOfTyconRef)+"."+vref.PropertyName|> Some
| ParentNone -> None
| None -> None
@@ -1397,18 +1393,15 @@ module internal SymbolHelpers =
match minfos with
| [] -> None
| FSMeth(_, _, vref, _) :: _ ->
- match vref.ActualParent with
+ match vref.DeclaringEntity with
| Parent tcref -> (tcref |> ticksAndArgCountTextOfTyconRef) + ".#ctor"|> Some
| ParentNone -> None
- | (ILMeth (_, minfo, _)) :: _ ->
- let tcref = minfo.DeclaringTyconRef
- (tcref |> ticksAndArgCountTextOfTyconRef)+".#ctor" |> Some
- | (DefaultStructCtor (g, typ) :: _) ->
- let tcref = tcrefOfAppTy g typ
- (ticksAndArgCountTextOfTyconRef tcref) + ".#ctor" |> Some
#if !NO_EXTENSIONTYPING
| ProvidedMeth _::_ -> None
#endif
+ | minfo :: _ ->
+ let tcref = minfo.DeclaringTyconRef
+ (tcref |> ticksAndArgCountTextOfTyconRef)+".#ctor" |> Some
| Item.CustomOperation (_, _, Some minfo) -> getKeywordForMethInfo minfo
| Item.MethodGroup(_, _, Some minfo) -> getKeywordForMethInfo minfo
| Item.MethodGroup(_, minfo :: _, _) -> getKeywordForMethInfo minfo
diff --git a/src/fsharp/symbols/SymbolPatterns.fs b/src/fsharp/symbols/SymbolPatterns.fs
index 8ae4b90bf9d..22b406e12fb 100644
--- a/src/fsharp/symbols/SymbolPatterns.fs
+++ b/src/fsharp/symbols/SymbolPatterns.fs
@@ -202,7 +202,7 @@ module Symbol =
/// Constructor (enclosingEntity)
let (|Constructor|_|) (func: FSharpMemberOrFunctionOrValue) =
match func.CompiledName with
- | ".ctor" | ".cctor" -> func.EnclosingEntity
+ | ".ctor" | ".cctor" -> func.DeclaringEntity
| _ -> None
let (|Function|_|) excluded (func: FSharpMemberOrFunctionOrValue) =
diff --git a/src/fsharp/symbols/Symbols.fs b/src/fsharp/symbols/Symbols.fs
index 43ba54e0810..4f8f461bebe 100644
--- a/src/fsharp/symbols/Symbols.fs
+++ b/src/fsharp/symbols/Symbols.fs
@@ -491,7 +491,7 @@ and FSharpEntity(cenv:cenv, entity:EntityRef) =
else
for minfo in GetImmediateIntrinsicMethInfosOfType (None, AccessibleFromSomeFSharpCode) cenv.g cenv.amap range0 entityTy do
yield createMember minfo
- let props = GetImmediateIntrinsicPropInfosOfType (None, AccessibleFromSomeFSharpCode) cenv.g cenv.amap range0 entityTy
+ let props = GetImmediateIntrinsicPropInfosOfType (None, AccessibleFromSomeFSharpCode) cenv.g cenv.amap range0 entityTy
let events = cenv.infoReader.GetImmediateIntrinsicEventsOfType (None, AccessibleFromSomeFSharpCode, range0, entityTy)
for pinfo in props do
yield FSharpMemberOrFunctionOrValue(cenv, P pinfo, Item.Property (pinfo.PropertyName, [pinfo]))
@@ -505,7 +505,7 @@ and FSharpEntity(cenv:cenv, entity:EntityRef) =
// For F#-declared extension members, yield a value-backed member and a property info if possible
let vref = mkNestedValRef entity v
yield FSharpMemberOrFunctionOrValue(cenv, V vref, Item.Value vref)
- match v.MemberInfo.Value.MemberFlags.MemberKind, v.ApparentParent with
+ match v.MemberInfo.Value.MemberFlags.MemberKind, v.ApparentEnclosingEntity with
| MemberKind.PropertyGet, Parent p ->
let pinfo = FSProp(cenv.g, generalizedTyconRef p, Some vref, None)
yield FSharpMemberOrFunctionOrValue(cenv, P pinfo, Item.Property (pinfo.PropertyName, [pinfo]))
@@ -565,7 +565,7 @@ and FSharpEntity(cenv:cenv, entity:EntityRef) =
let formalTypeInfo = ILTypeInfo.FromType cenv.g ty
tdef.Fields.AsList
|> List.map (fun tdef -> let ilFieldInfo = ILFieldInfo(formalTypeInfo, tdef)
- FSharpField(cenv, FSharpFieldData.ILField(cenv.g, ilFieldInfo) ))
+ FSharpField(cenv, FSharpFieldData.ILField(ilFieldInfo) ))
|> makeReadOnlyCollection
else
@@ -711,19 +711,21 @@ and FSharpUnionCase(cenv, v: UnionCaseRef) =
and FSharpFieldData =
- | ILField of TcGlobals * ILFieldInfo
+ | ILField of ILFieldInfo
| RecdOrClass of RecdFieldRef
| Union of UnionCaseRef * int
+
member x.TryRecdField =
match x with
| RecdOrClass v -> v.RecdField |> Choice1Of2
| Union (v, n) -> v.FieldByIndex(n) |> Choice1Of2
- | ILField (_, f) -> f |> Choice2Of2
+ | ILField f -> f |> Choice2Of2
+
member x.DeclaringTyconRef =
match x with
| RecdOrClass v -> v.TyconRef
| Union (v, _) -> v.TyconRef
- | ILField (g, f) -> tcrefOfAppTy g f.EnclosingType
+ | ILField f -> f.DeclaringTyconRef
and FSharpField(cenv: cenv, d: FSharpFieldData) =
inherit FSharpSymbol (cenv,
@@ -735,8 +737,8 @@ and FSharpField(cenv: cenv, d: FSharpFieldData) =
| Union (v, _) ->
// This is not correct: there is no "Item" for a named union case field
Item.UnionCase(UnionCaseInfo(generalizeTypars v.TyconRef.TyparsNoRange, v), false)
- | ILField (_, f) ->
- Item.ILField(f)),
+ | ILField f ->
+ Item.ILField f),
(fun this thisCcu2 ad ->
checkForCrossProjectAccessibility (thisCcu2, ad) (cenv.thisCcu, (this :?> FSharpField).Accessibility.Contents))
//&&
@@ -812,7 +814,7 @@ and FSharpField(cenv: cenv, d: FSharpFieldData) =
| Union (v, _) ->
let unionCase = UnionCaseInfo(generalizeTypars v.TyconRef.TyparsNoRange, v)
SymbolHelpers.GetXmlDocSigOfUnionCaseInfo unionCase
- | ILField (_, f) ->
+ | ILField f ->
SymbolHelpers.GetXmlDocSigOfILFieldInfo cenv.infoReader range0 f
match xmlsig with
| Some (_, docsig) -> docsig
@@ -937,10 +939,10 @@ and FSharpActivePatternGroup(cenv, apinfo:PrettyNaming.ActivePatternInfo, typ, v
member __.OverallType = FSharpType(cenv, typ)
- member __.EnclosingEntity =
+ member __.DeclaringEntity =
valOpt
|> Option.bind (fun vref ->
- match vref.ActualParent with
+ match vref.DeclaringEntity with
| ParentNone -> None
| Parent p -> Some (FSharpEntity(cenv, p)))
@@ -1258,14 +1260,25 @@ and FSharpMemberOrFunctionOrValue(cenv, d:FSharpMemberOrValData, item) =
| Some v -> v
| None -> failwith "DeclarationLocation property not available"
- member __.LogicalEnclosingEntity =
+ member __.DeclaringEntity =
checkIsResolved()
match d with
- | E m -> FSharpEntity(cenv, tcrefOfAppTy cenv.g m.EnclosingType)
- | P m -> FSharpEntity(cenv, tcrefOfAppTy cenv.g m.EnclosingType)
- | M m | C m -> FSharpEntity(cenv, tcrefOfAppTy cenv.g m.EnclosingType)
+ | E e -> FSharpEntity(cenv, e.DeclaringTyconRef) |> Some
+ | P p -> FSharpEntity(cenv, p.DeclaringTyconRef) |> Some
+ | M m | C m -> FSharpEntity(cenv, m.DeclaringTyconRef) |> Some
| V v ->
- match v.ApparentParent with
+ match v.DeclaringEntity with
+ | ParentNone -> None
+ | Parent p -> FSharpEntity(cenv, p) |> Some
+
+ member __.ApparentEnclosingEntity =
+ checkIsResolved()
+ match d with
+ | E e -> FSharpEntity(cenv, e.ApparentEnclosingTyconRef)
+ | P p -> FSharpEntity(cenv, p.ApparentEnclosingTyconRef)
+ | M m | C m -> FSharpEntity(cenv, m.ApparentEnclosingTyconRef)
+ | V v ->
+ match v.ApparentEnclosingEntity with
| ParentNone -> invalidOp "the value or member doesn't have a logical parent"
| Parent p -> FSharpEntity(cenv, p)
@@ -1296,7 +1309,7 @@ and FSharpMemberOrFunctionOrValue(cenv, d:FSharpMemberOrValData, item) =
if isUnresolved() then false
else
match d with
- | P m -> m.HasGetter
+ | P p -> p.HasGetter
| E _
| M _
| C _
@@ -1305,19 +1318,35 @@ and FSharpMemberOrFunctionOrValue(cenv, d:FSharpMemberOrValData, item) =
member __.GetterMethod =
checkIsResolved()
match d with
- | P m -> mkMethSym m.GetterMethod
+ | P p -> mkMethSym p.GetterMethod
| E _ | M _ | C _ | V _ -> invalidOp "the value or member doesn't have an associated getter method"
+ member __.HasSetterMethod =
+ if isUnresolved() then false
+ else
+ match d with
+ | P p -> p.HasSetter
+ | E _
+ | M _
+ | C _
+ | V _ -> false
+
+ member __.SetterMethod =
+ checkIsResolved()
+ match d with
+ | P p -> mkMethSym p.SetterMethod
+ | E _ | M _ | C _ | V _ -> invalidOp "the value or member doesn't have an associated setter method"
+
member __.EventAddMethod =
checkIsResolved()
match d with
- | E e -> mkMethSym (e.GetAddMethod())
+ | E e -> mkMethSym e.AddMethod
| P _ | M _ | C _ | V _ -> invalidOp "the value or member doesn't have an associated add method"
member __.EventRemoveMethod =
checkIsResolved()
match d with
- | E e -> mkMethSym (e.GetRemoveMethod())
+ | E e -> mkMethSym e.RemoveMethod
| P _ | M _ | C _ | V _ -> invalidOp "the value or member doesn't have an associated remove method"
member __.EventDelegateType =
@@ -1334,33 +1363,6 @@ and FSharpMemberOrFunctionOrValue(cenv, d:FSharpMemberOrValData, item) =
TryDestStandardDelegateTyp cenv.infoReader range0 AccessibleFromSomewhere dty |> Option.isSome
| P _ | M _ | C _ | V _ -> invalidOp "the value or member is not an event"
- member __.HasSetterMethod =
- if isUnresolved() then false
- else
- match d with
- | P m -> m.HasSetter
- | E _
- | M _
- | C _
- | V _ -> false
-
- member __.SetterMethod =
- checkIsResolved()
- match d with
- | P m -> mkMethSym m.SetterMethod
- | E _ | M _ | C _ | V _ -> invalidOp "the value or member doesn't have an associated setter method"
-
- member __.EnclosingEntity =
- checkIsResolved()
- match d with
- | E m -> FSharpEntity(cenv, tcrefOfAppTy cenv.g m.EnclosingType) |> Some
- | P m -> FSharpEntity(cenv, tcrefOfAppTy cenv.g m.EnclosingType) |> Some
- | M m | C m -> FSharpEntity(cenv, m.DeclaringEntityRef) |> Some
- | V v ->
- match v.ActualParent with
- | ParentNone -> None
- | Parent p -> FSharpEntity(cenv, p) |> Some
-
member __.IsCompilerGenerated =
if isUnresolved() then false else
match fsharpInfo() with
@@ -1400,7 +1402,7 @@ and FSharpMemberOrFunctionOrValue(cenv, d:FSharpMemberOrValData, item) =
member __.IsDispatchSlot =
if isUnresolved() then false else
match d with
- | E e -> e.GetAddMethod().IsDispatchSlot
+ | E e -> e.AddMethod.IsDispatchSlot
| P p -> p.IsDispatchSlot
| M m | C m -> m.IsDispatchSlot
| V v -> v.IsDispatchSlot
@@ -1418,8 +1420,8 @@ and FSharpMemberOrFunctionOrValue(cenv, d:FSharpMemberOrValData, item) =
member x.EventForFSharpProperty =
match d with
| P p when p.IsFSharpEventProperty ->
- let minfos1 = GetImmediateIntrinsicMethInfosOfType (Some("add_"+p.PropertyName), AccessibleFromSomeFSharpCode) cenv.g cenv.amap range0 p.EnclosingType
- let minfos2 = GetImmediateIntrinsicMethInfosOfType (Some("remove_"+p.PropertyName), AccessibleFromSomeFSharpCode) cenv.g cenv.amap range0 p.EnclosingType
+ let minfos1 = GetImmediateIntrinsicMethInfosOfType (Some("add_"+p.PropertyName), AccessibleFromSomeFSharpCode) cenv.g cenv.amap range0 p.ApparentEnclosingType
+ let minfos2 = GetImmediateIntrinsicMethInfosOfType (Some("remove_"+p.PropertyName), AccessibleFromSomeFSharpCode) cenv.g cenv.amap range0 p.ApparentEnclosingType
match minfos1, minfos2 with
| [addMeth], [removeMeth] ->
match addMeth.ArbitraryValRef, removeMeth.ArbitraryValRef with
@@ -1433,9 +1435,10 @@ and FSharpMemberOrFunctionOrValue(cenv, d:FSharpMemberOrValData, item) =
match d with
| M m when m.LogicalName.StartsWith("add_") ->
let eventName = m.LogicalName.[4..]
- let entityTy = generalizedTyconRef m.DeclaringEntityRef
+ let entityTy = generalizedTyconRef m.DeclaringTyconRef
not (isNil (cenv.infoReader.GetImmediateIntrinsicEventsOfType (Some eventName, AccessibleFromSomeFSharpCode, range0, entityTy))) ||
- match GetImmediateIntrinsicPropInfosOfType(Some eventName, AccessibleFromSomeFSharpCode) cenv.g cenv.amap range0 (generalizedTyconRef m.DeclaringEntityRef) with
+ let declaringTy = generalizedTyconRef m.DeclaringTyconRef
+ match GetImmediateIntrinsicPropInfosOfType (Some eventName, AccessibleFromSomeFSharpCode) cenv.g cenv.amap range0 declaringTy with
| pinfo :: _ -> pinfo.IsFSharpEventProperty
| _ -> false
@@ -1446,9 +1449,10 @@ and FSharpMemberOrFunctionOrValue(cenv, d:FSharpMemberOrValData, item) =
match d with
| M m when m.LogicalName.StartsWith("remove_") ->
let eventName = m.LogicalName.[7..]
- let entityTy = generalizedTyconRef m.DeclaringEntityRef
+ let entityTy = generalizedTyconRef m.DeclaringTyconRef
not (isNil (cenv.infoReader.GetImmediateIntrinsicEventsOfType (Some eventName, AccessibleFromSomeFSharpCode, range0, entityTy))) ||
- match GetImmediateIntrinsicPropInfosOfType(Some eventName, AccessibleFromSomeFSharpCode) cenv.g cenv.amap range0 (generalizedTyconRef m.DeclaringEntityRef) with
+ let declaringTy = generalizedTyconRef m.DeclaringTyconRef
+ match GetImmediateIntrinsicPropInfosOfType (Some eventName, AccessibleFromSomeFSharpCode) cenv.g cenv.amap range0 declaringTy with
| pinfo :: _ -> pinfo.IsFSharpEventProperty
| _ -> false
| _ -> false
@@ -1472,7 +1476,8 @@ and FSharpMemberOrFunctionOrValue(cenv, d:FSharpMemberOrValData, item) =
match d with
| M m when m.LogicalName.StartsWith("get_") ->
let propName = PrettyNaming.ChopPropertyName(m.LogicalName)
- not (isNil (GetImmediateIntrinsicPropInfosOfType(Some propName, AccessibleFromSomeFSharpCode) cenv.g cenv.amap range0 (generalizedTyconRef m.DeclaringEntityRef)))
+ let declaringTy = generalizedTyconRef m.DeclaringTyconRef
+ not (isNil (GetImmediateIntrinsicPropInfosOfType (Some propName, AccessibleFromSomeFSharpCode) cenv.g cenv.amap range0 declaringTy))
| V v -> v.IsPropertyGetterMethod
| _ -> false
@@ -1482,7 +1487,8 @@ and FSharpMemberOrFunctionOrValue(cenv, d:FSharpMemberOrValData, item) =
// Look for a matching property with the right name.
| M m when m.LogicalName.StartsWith("set_") ->
let propName = PrettyNaming.ChopPropertyName(m.LogicalName)
- not (isNil (GetImmediateIntrinsicPropInfosOfType(Some propName, AccessibleFromSomeFSharpCode) cenv.g cenv.amap range0 (generalizedTyconRef m.DeclaringEntityRef)))
+ let declaringTy = generalizedTyconRef m.DeclaringTyconRef
+ not (isNil (GetImmediateIntrinsicPropInfosOfType (Some propName, AccessibleFromSomeFSharpCode) cenv.g cenv.amap range0 declaringTy))
| V v -> v.IsPropertySetterMethod
| _ -> false
@@ -1506,7 +1512,7 @@ and FSharpMemberOrFunctionOrValue(cenv, d:FSharpMemberOrValData, item) =
member __.IsExtensionMember =
if isUnresolved() then false else
match d with
- | E e -> e.GetAddMethod().IsExtensionMember
+ | E e -> e.AddMethod.IsExtensionMember
| P p -> p.IsExtensionMember
| M m -> m.IsExtensionMember
| V v -> v.IsExtensionMember
@@ -1516,7 +1522,7 @@ and FSharpMemberOrFunctionOrValue(cenv, d:FSharpMemberOrValData, item) =
member __.IsOverrideOrExplicitInterfaceImplementation =
if isUnresolved() then false else
match d with
- | E e -> e.GetAddMethod().IsDefiniteFSharpOverride
+ | E e -> e.AddMethod.IsDefiniteFSharpOverride
| P p -> p.IsDefiniteFSharpOverride
| M m -> m.IsDefiniteFSharpOverride
| V v ->
@@ -1526,7 +1532,7 @@ and FSharpMemberOrFunctionOrValue(cenv, d:FSharpMemberOrValData, item) =
member __.IsExplicitInterfaceImplementation =
if isUnresolved() then false else
match d with
- | E e -> e.GetAddMethod().IsFSharpExplicitInterfaceImplementation
+ | E e -> e.AddMethod.IsFSharpExplicitInterfaceImplementation
| P p -> p.IsFSharpExplicitInterfaceImplementation
| M m -> m.IsFSharpExplicitInterfaceImplementation
| V v -> v.IsFSharpExplicitInterfaceImplementation cenv.g
@@ -1536,7 +1542,7 @@ and FSharpMemberOrFunctionOrValue(cenv, d:FSharpMemberOrValData, item) =
checkIsResolved()
let sigs =
match d with
- | E e -> e.GetAddMethod().ImplementedSlotSignatures
+ | E e -> e.AddMethod.ImplementedSlotSignatures
| P p -> p.ImplementedSlotSignatures
| M m | C m -> m.ImplementedSlotSignatures
| V v -> v.ImplementedSlotSignatures
@@ -1603,7 +1609,7 @@ and FSharpMemberOrFunctionOrValue(cenv, d:FSharpMemberOrValData, item) =
| Some (_, docsig) -> docsig
| _ -> ""
| V v ->
- match v.ActualParent with
+ match v.DeclaringEntity with
| Parent entityRef ->
match SymbolHelpers.GetXmlDocSigOfScopedValRef cenv.g entityRef v with
| Some (_, docsig) -> docsig
@@ -1766,9 +1772,9 @@ and FSharpMemberOrFunctionOrValue(cenv, d:FSharpMemberOrValData, item) =
// For IL events, we get an approximate accessiblity that at least reports "internal" as "internal" and "private" as "private"
let access =
match e with
- | ILEvent (_, x) ->
- let ilAccess = AccessibilityLogic.GetILAccessOfILEventInfo x
- getApproxFSharpAccessibilityOfMember this.EnclosingEntity.Value.Entity ilAccess
+ | ILEvent ileinfo ->
+ let ilAccess = AccessibilityLogic.GetILAccessOfILEventInfo ileinfo
+ getApproxFSharpAccessibilityOfMember this.DeclaringEntity.Value.Entity ilAccess
| _ -> taccessPublic
FSharpAccessibility(access)
@@ -1777,9 +1783,9 @@ and FSharpMemberOrFunctionOrValue(cenv, d:FSharpMemberOrValData, item) =
// For IL properties, we get an approximate accessiblity that at least reports "internal" as "internal" and "private" as "private"
let access =
match p with
- | ILProp (_, x) ->
- let ilAccess = AccessibilityLogic.GetILAccessOfILPropInfo x
- getApproxFSharpAccessibilityOfMember this.EnclosingEntity.Value.Entity ilAccess
+ | ILProp ilpinfo ->
+ let ilAccess = AccessibilityLogic.GetILAccessOfILPropInfo ilpinfo
+ getApproxFSharpAccessibilityOfMember this.DeclaringEntity.Value.Entity ilAccess
| _ -> taccessPublic
FSharpAccessibility(access)
@@ -2060,7 +2066,7 @@ and FSharpAttribute(cenv: cenv, attrib: AttribInfo) =
NicePrint.stringOfFSAttrib (denv.Contents g) attrib
| AttribInfo.ILAttribInfo (g, _, _scoref, cattr, _) ->
let parms, _args = decodeILAttribData g.ilg cattr
- NicePrint.stringOfILAttrib (denv.Contents g) (cattr.Method.EnclosingType, parms)
+ NicePrint.stringOfILAttrib (denv.Contents g) (cattr.Method.DeclaringType, parms)
override __.ToString() =
if entityIsUnresolved attrib.TyconRef then "attribute ???" else "attribute " + attrib.TyconRef.CompiledName + "(...)"
@@ -2208,7 +2214,7 @@ type FSharpSymbol with
| Item.ExnCase tcref -> FSharpEntity(cenv, tcref) :>_
| Item.RecdField rfinfo -> FSharpField(cenv, RecdOrClass rfinfo.RecdFieldRef) :> _
- | Item.ILField finfo -> FSharpField(cenv, ILField (cenv.g, finfo)) :> _
+ | Item.ILField finfo -> FSharpField(cenv, ILField finfo) :> _
| Item.Event einfo ->
FSharpMemberOrFunctionOrValue(cenv, E einfo, item) :> _
@@ -2306,3 +2312,4 @@ type FSharpSymbolUse(g:TcGlobals, denv: DisplayEnv, symbol:FSharpSymbol, itemOcc
member __.Range = Range.toZ range
member __.RangeAlternate = range
+ override __.ToString() = sprintf "%O, %O, %O" symbol itemOcc range
diff --git a/src/fsharp/symbols/Symbols.fsi b/src/fsharp/symbols/Symbols.fsi
index 5d9c1b9417c..462544bd208 100644
--- a/src/fsharp/symbols/Symbols.fsi
+++ b/src/fsharp/symbols/Symbols.fsi
@@ -641,8 +641,11 @@ and [] public FSharpMemberOrFunctionOrValue =
member IsUnresolved : bool
/// Get the enclosing entity for the definition
- member EnclosingEntity : FSharpEntity option
+ member DeclaringEntity : FSharpEntity option
+ /// Get the logical enclosing entity, which for an extension member is type being extended
+ member ApparentEnclosingEntity: FSharpEntity
+
/// Get the declaration location of the member, function or value
member DeclarationLocation: range
@@ -768,9 +771,6 @@ and [] public FSharpMemberOrFunctionOrValue =
/// Get the logical name of the member
member LogicalName: string
- /// Get the logical enclosing entity, which for an extension member is type being extended
- member LogicalEnclosingEntity: FSharpEntity
-
/// Get the name as presented in F# error messages and documentation
member DisplayName : string
@@ -882,8 +882,8 @@ and [] public FSharpActivePatternGroup =
/// Get the type indicating signature of the active pattern
member OverallType : FSharpType
- /// Try to get the enclosing entity of the active pattern
- member EnclosingEntity : FSharpEntity option
+ /// Try to get the entity in which the active pattern is declared
+ member DeclaringEntity : FSharpEntity option
and [] public FSharpType =
diff --git a/src/fsharp/tast.fs b/src/fsharp/tast.fs
index 8e5ba69dcd7..5912bb1ea3d 100755
--- a/src/fsharp/tast.fs
+++ b/src/fsharp/tast.fs
@@ -2220,7 +2220,7 @@ and []
// -- LinearizeTopMatch
//
// The fresh temporary should just be created with the right parent
- mutable val_actual_parent: ParentRef
+ mutable val_declaring_entity: ParentRef
/// XML documentation attached to a value.
/// MUTABILITY: for unpickle linkage
@@ -2294,7 +2294,7 @@ and []
member x.LinkagePartialKey : ValLinkagePartialKey =
assert x.IsCompiledAsTopLevel
{ LogicalName = x.LogicalName
- MemberParentMangledName = (if x.IsMember then Some x.MemberApparentParent.LogicalName else None)
+ MemberParentMangledName = (if x.IsMember then Some x.MemberApparentEntity.LogicalName else None)
MemberIsOverride = x.IsOverrideOrExplicitImpl
TotalArgCount = if x.IsMember then x.ValReprInfo.Value.TotalArgCount else 0 }
@@ -2412,26 +2412,26 @@ and []
and set(v) = x.val_xmldocsig <- v
/// The parent type or module, if any (None for expression bindings and parameters)
- member x.ActualParent = x.val_actual_parent
+ member x.DeclaringEntity = x.val_declaring_entity
/// Get the actual parent entity for the value (a module or a type), i.e. the entity under which the
/// value will appear in compiled code. For extension members this is the module where the extension member
/// is declared.
- member x.TopValActualParent =
- match x.ActualParent with
+ member x.TopValDeclaringEntity =
+ match x.DeclaringEntity with
| Parent tcref -> tcref
- | ParentNone -> error(InternalError("TopValActualParent: does not have a parent",x.Range))
+ | ParentNone -> error(InternalError("TopValDeclaringEntity: does not have a parent",x.Range))
- member x.HasTopValActualParent =
- match x.ActualParent with
+ member x.HasDeclaringEntity =
+ match x.DeclaringEntity with
| Parent _ -> true
| ParentNone -> false
/// Get the apparent parent entity for a member
- member x.MemberApparentParent : TyconRef =
+ member x.MemberApparentEntity : TyconRef =
match x.MemberInfo with
- | Some membInfo -> membInfo.ApparentParent
- | None -> error(InternalError("MemberApparentParent",x.Range))
+ | Some membInfo -> membInfo.ApparentEnclosingEntity
+ | None -> error(InternalError("MemberApparentEntity",x.Range))
/// Get the number of 'this'/'self' object arguments for the member. Instance extension members return '1'.
member v.NumObjArgs =
@@ -2442,10 +2442,10 @@ and []
/// Get the apparent parent entity for the value, i.e. the entity under with which the
/// value is associated. For extension members this is the nominal type the member extends.
/// For other values it is just the actual parent.
- member x.ApparentParent =
+ member x.ApparentEnclosingEntity =
match x.MemberInfo with
- | Some membInfo -> Parent(membInfo.ApparentParent)
- | None -> x.ActualParent
+ | Some membInfo -> Parent(membInfo.ApparentEnclosingEntity)
+ | None -> x.DeclaringEntity
/// Get the public path to the value, if any? Should be set if and only if
/// IsMemberOrModuleBinding is set.
@@ -2459,7 +2459,7 @@ and []
// - in ilxgen.fs: as a boolean to detect public values for saving quotations
// - in MakeExportRemapping, to build non-local references for values
member x.PublicPath =
- match x.ActualParent with
+ match x.DeclaringEntity with
| Parent eref ->
match eref.PublicPath with
| None -> None
@@ -2587,7 +2587,7 @@ and []
val_member_info = Unchecked.defaultof<_>
val_attribs = Unchecked.defaultof<_>
val_repr_info = Unchecked.defaultof<_>
- val_actual_parent = Unchecked.defaultof<_>
+ val_declaring_entity = Unchecked.defaultof<_>
val_xmldoc = Unchecked.defaultof<_>
val_xmldocsig = Unchecked.defaultof<_> }
@@ -2613,7 +2613,7 @@ and []
x.val_member_info <- tg.val_member_info
x.val_attribs <- tg.val_attribs
x.val_repr_info <- tg.val_repr_info
- x.val_actual_parent <- tg.val_actual_parent
+ x.val_declaring_entity <- tg.val_declaring_entity
x.val_xmldoc <- tg.val_xmldoc
x.val_xmldocsig <- tg.val_xmldocsig
@@ -2627,7 +2627,7 @@ and
[]
ValMemberInfo =
{ /// The parent type. For an extension member this is the type being extended
- ApparentParent: TyconRef
+ ApparentEnclosingEntity: TyconRef
/// Updated with the full implemented slotsig after interface implementation relation is checked
mutable ImplementedSlotSigs: SlotSig list
@@ -3240,12 +3240,12 @@ and
member x.Accessibility = x.Deref.Accessibility
/// The parent type or module, if any (None for expression bindings and parameters)
- member x.ActualParent = x.Deref.ActualParent
+ member x.DeclaringEntity = x.Deref.DeclaringEntity
/// Get the apparent parent entity for the value, i.e. the entity under with which the
/// value is associated. For extension members this is the nominal type the member extends.
/// For other values it is just the actual parent.
- member x.ApparentParent = x.Deref.ApparentParent
+ member x.ApparentEnclosingEntity = x.Deref.ApparentEnclosingEntity
member x.DefinitionRange = x.Deref.DefinitionRange
@@ -3373,13 +3373,13 @@ and
/// Get the actual parent entity for the value (a module or a type), i.e. the entity under which the
/// value will appear in compiled code. For extension members this is the module where the extension member
/// is declared.
- member x.TopValActualParent = x.Deref.TopValActualParent
+ member x.TopValDeclaringEntity = x.Deref.TopValDeclaringEntity
// Can be false for members after error recovery
- member x.HasTopValActualParent = x.Deref.HasTopValActualParent
+ member x.HasDeclaringEntity = x.Deref.HasDeclaringEntity
/// Get the apparent parent entity for a member
- member x.MemberApparentParent = x.Deref.MemberApparentParent
+ member x.MemberApparentEntity = x.Deref.MemberApparentEntity
/// Get the number of 'this'/'self' object arguments for the member. Instance extension members return '1'.
member x.NumObjArgs = x.Deref.NumObjArgs
@@ -4988,7 +4988,7 @@ let NewVal (logicalName:string,m:range,compiledName,ty,isMutable,isCompGen,arity
val_other_range=None
val_defn=None
val_repr_info= arity
- val_actual_parent= actualParent
+ val_declaring_entity= actualParent
val_flags = ValFlags(recValInfo,baseOrThis,isCompGen,inlineInfo,isMutable,isModuleOrMemberBinding,isExtensionMember,isIncrClassSpecialMember,isTyFunc,allowTypeInst,isGeneratedEventVal)
val_const= konst
val_access=access
diff --git a/src/fsharp/test.snk b/src/fsharp/test.snk
new file mode 100644
index 00000000000..c16543bdc48
Binary files /dev/null and b/src/fsharp/test.snk differ
diff --git a/src/fsharp/xlf/FSComp.txt.cs.xlf b/src/fsharp/xlf/FSComp.txt.cs.xlf
index 9cdaa6a18fd..8a33cd21b02 100644
--- a/src/fsharp/xlf/FSComp.txt.cs.xlf
+++ b/src/fsharp/xlf/FSComp.txt.cs.xlf
@@ -1669,7 +1669,7 @@
The member or object constructor '{0}' is not {1}. Private members may only be accessed from within the declaring type. Protected members may only be accessed from an extending type and cannot be accessed from inner lambda expressions.
- Konstruktor členu nebo objektu {0} není {1}. K soukromým členům se dá přistupovat jenom z deklarujícího typu. K chráněným členům se dá přistupovat jenom z rozšiřujícího typu a nedá se k nim přistupovat z vnitřních výrazů lambda.
+ Konstruktor členu nebo objektu {0} není {1}. K soukromým členům se dá přistupovat jenom z deklarujícího typu. K chráněným členům se dá přistupovat jenom z rozšiřujícího typu a nedá se k nim přistupovat z vnitřních výrazů lambda.
@@ -6967,6 +6967,11 @@
Při čtení metadat jazyka F# sestavení {0} došlo k chybě. Byl použit rezervovaný konstruktor. Je možné, že budete muset upgradovat kompilátor jazyka F# nebo použít dřívější verzi sestavení, ve které se nevyužívá konkrétní konstruktor.
+
+ This method or property is not normally used from F# code, use an explicit tuple pattern for deconstruction instead.
+ This method or property is not normally used from F# code, use an explicit tuple pattern for deconstruction instead.
+
+