Skip to content

Improve error reporting: This expression was expected to have type 'A' but here has type 'A' #2561

@smoothdeveloper

Description

@smoothdeveloper

what

Microsoft (R) F# Compiler version 4.1
Copyright (c) Microsoft Corporation. All Rights Reserved.

app.fs(4,19): error FS0001: This expression was expected to have type
    'A'
but here has type
    'A'

When facing this error message, a beginner might not figure out that the issue might be due to hard to diagnose / reference / build related issue.

why

the compiler has some heuristics to display the type name in it's simplest form, when the heuristics are exhausted and if the names are identical, we should try one step further and bring the assembly name as a discriminant.

how

Microsoft (R) F# Compiler version 4.1
Copyright (c) Microsoft Corporation. All Rights Reserved.

app.fs(4,19): error FS0001: This expression was expected to have type
    'A (lib1, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null)'
but here has type
    'A (lib2, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null)'

related #1103

I'm preparing a PR for this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions