dotnet / dotnet/fsharp

{||} cannot be used as a type

Open
#6,941 16 comments 0 reactions 0 assignees View on GitHub
Area-Compiler-Checking Bug Impact-Medium
Dominant language
F#
Stars
4.3k
Forks
876
Avg merge
4d 11h
Merged PRs (30d)
131

Description

`{||}` cannot be used as a type.

**Expected behavior**

```fs

Microsoft (R) F# Interactive version 10.4.0 for F# 4.6
Copyright (c) Microsoft Corporation. All Rights Reserved.

For help type #help;;

> {||};;
val it : {||} = {}

> let x = {||};;
val x : {||} = {}

> let x : {||} = {||};;
val x : {||} = {}
```

**Repro steps and actual behavior**

```fs

Microsoft (R) F# Interactive version 10.4.0 for F# 4.6
Copyright (c) Microsoft Corporation. All Rights Reserved.

For help type #help;;

> {||};;
val it : {||} = {}

> let x = {||};;
val x : {||} = {}

> let x : {||} = {||};;

let x : {||} = {||};;
----------^^

stdin(3,11): error FS0010: Unexpected symbol '|}' in field declaration. Expected identifier or other token.
```

**Known workarounds**

Let the compiler infer the type.

Related information
Microsoft Visual Studio Community 2019
Version 16.1.1
VisualStudio.16.Release/16.1.1+28922.388
Microsoft .NET Framework
Version 4.7.03056

Installed Version: Community

Visual C++ 2019 00435-60000-00000-AA419
Microsoft Visual C++ 2019

Application Insights Tools for Visual Studio Package 9.1.00429.1
Application Insights Tools for Visual Studio

ASP.NET and Web Tools 2019 16.1.429.50124
ASP.NET and Web Tools 2019

Azure App Service Tools v3.0.0 16.1.429.50124
Azure App Service Tools v3.0.0

C# Tools 3.1.0-beta4-19266-03+9d80dea7fe1b14043b9b2ac4d0b59ed26f508742
C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Common Azure Tools 1.10
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.

Extensibility Message Bus 1.1.77 (master@24013d5)
Provides common messaging-based MEF services for loosely coupled Visual Studio extension components communication and integration.

Microsoft JVM Debugger 1.0
Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines

Microsoft MI-Based Debugger 1.0
Provides support for connecting Visual Studio to MI compatible debuggers

Microsoft Visual C++ Wizards 1.0
Microsoft Visual C++ Wizards

Microsoft Visual Studio VC Package 1.0
Microsoft Visual Studio VC Package

Mono Debugging for Visual Studio 16.1.1 (2473f22)
Support for debugging Mono processes with Visual Studio.

NuGet Package Manager 5.1.0
NuGet Package Manager in Visual Studio. For more information about NuGet, visit https://docs.nuget.org/

ProjectServicesPackage Extension 1.0
ProjectServicesPackage Visual Studio Extension Detailed Info

ResourcePackage Extension 1.0
ResourcePackage Visual Studio Extension Detailed Info

ResourcePackage Extension 1.0
ResourcePackage Visual Studio Extension Detailed Info

Syntax Visualizer 1.0
An extension for visualizing Roslyn SyntaxTrees.

TypeScript Tools 16.0.10506.2004
TypeScript Tools for Microsoft Visual Studio

Visual Basic Tools 3.1.0-beta4-19266-03+9d80dea7fe1b14043b9b2ac4d0b59ed26f508742
Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Visual F# Tools 10.4 for F# 4.6 16.1.0-beta.19253.3+42526fe359672a05fd562dc16a91a43d0fe047a7
Microsoft Visual F# Tools 10.4 for F# 4.6

Visual Studio Code Debug Adapter Host Package 1.0
Interop layer for hosting Visual Studio Code debug adapters in Visual Studio

Visual Studio Tools for Unity 4.1.1.0
Visual Studio Tools for Unity

VisualStudio.Mac 1.0
Mac Extension for Visual Studio

Xamarin 16.1.0.542 (d16-1@68b985244)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin Designer 16.1.0.418 (remotes/origin/d16-1@5b958bb10)
Visual Studio extension to enable Xamarin Designer tools in Visual Studio.

Xamarin Templates 16.2.112 (4db4af4)
Templates for building iOS, Android, and Windows apps with Xamarin and Xamarin.Forms.

Xamarin.Android SDK 9.3.0.22 (HEAD/8e7764fdf)
Xamarin.Android Reference Assemblies and MSBuild support.
Mono: mono/mono/2018-08@3cb36842fc4
Java.Interop: xamarin/java.interop/d16-1@5ddc3e3
LibZipSharp: grendello/LibZipSharp/d16-1@44de300
LibZip: nih-at/libzip/rel-1-5-1@b95cf3f
ProGuard: xamarin/proguard/master@905836d
SQLite: xamarin/sqlite/3.27.1@8212a2d
Xamarin.Android Tools: xamarin/xamarin-android-tools/d16-1@acabd26

Xamarin.iOS and Xamarin.Mac SDK 12.10.0.153 (750a879)
Xamarin.iOS and Xamarin.Mac Reference Assemblies and MSBuild support.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.