Skip to content

Indentation Bug in Generic Type Parameters #1494

@cloudRoutine

Description

@cloudRoutine

This is valid

open System

    module Z =
        type Alpha< ^b, ^a 
    when ^     a    :  (member Name:string)
and    ^a:        (member Zip
   : ^b when
^b : struct   )
and             ^a
:                 (static member(+)
    :    'a * 'a 
-> 'a 
) 
         > () = 
            member inline __.X = ()
        with  
        static member inline Y = ()

This gives an indentation warning on the ( before static

type TypeWithALongName< ^a 
    when ^a:(static member(+):'a * 'a -> 'a )
    and  ^a:(static member(-):'a * 'a -> 'a )            
    and  ^a:(static member(*):'a * 'a -> 'a )            
    and  ^a:(static member(/):'a * 'a -> 'a )            
    > =
    static member inline X = ()

It seems like there should be no warning on the latter and the former should be cause for multiple compiler errors

The F# 4.0 Spec states

The F# language uses simplified, indentation-aware syntactic constructs known as lightweight
syntax. The lines of the sample program in the previous section form a sequence of declarations and
are aligned on the same column.

So generics don't count?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Impact-Low(Internal MS Team use only) Describes an issue with limited impact on existing code.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions