The constructor for the Window type is required to initialize all explicit fieldws (ie. "val"s) which are not marked [<DefaultValue>], and you have not initialized the rangeItem field.

So you can:

either add [<DefaultValue>] to the rangeItem, ie.

1
2
3
 
    [<DefaultValue>]
    val rangeItem:Range; 

Or initialize the rangeItem in the new() for Window... (I'll post the whole solution, with formatting.)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
open System

open System.Collections.Generic;

type Range =
    val signature: string;
    val leftPos:int;
    val rightPos:int;
    val inWindow:bool;
    member x.Signature = x.signature
    member x.LeftPos = x.leftPos
    member x.RightPos = x.rightPos
    member x.InWindow = x.inWindow
    // ADD CONSTRUCTOR
    new() = { signature = ""; leftPos = 0; rightPos = 0; inWindow = false; }

type Window =
    val rangeItem:Range; //this is the offending line error goes away if commented out
    val leftWindowRangeIndex : int;
    val rightWindowRangeIndex : int;
    new() = { leftWindowRangeIndex=0; //this line shows error
                rightWindowRangeIndex=0;
                rangeItem = new Range(); } // INITIALIZE rangeItem

See Explicit Fields in MSDN

To format F# code in this forum, use the F# button in the tools for message editing (second row), or insert

By on 9/30/2009 3:40 AM ()
IntelliFactory Offices Copyright (c) 2011-2012 IntelliFactory. All rights reserved.
Home | Products | Consulting | Trainings | Blogs | Jobs | Contact Us | Terms of Use | Privacy Policy | Cookie Policy
Built with WebSharper