Wiki

Ticket #199 (new defect) — at Initial Version

Opened 15 years ago

Last modified 15 years ago

Missing inout gets C# error message rather than Cobra error message.

Reported by: torial Owned by:
Priority: medium Milestone:
Component: Cobra Compiler Version: 0.8.0
Keywords: error message Cc:

Description

If a call to a fxn that has inout parameters is made w/o the inout parameter, the C# equivalent message is given: "error: Argument "1" must be passed with the "ref" keyword" However, adding "ref" before argument 1 does not fix the issue, adding "inout" does.

%% args -ref:System.Xml -ref:System.Drawing

use System.Windows.Forms #from "System.Windows.Forms"
use System.Xml #from "System.Xml"
use System.Text.RegularExpressions
use System.Drawing

class WordMatcher inherits Form
    
    cue init
        base.init
        .text = 'TMX Word Match Finder'
        .width = 800
        .height = 600
        
        list = List<of int>()
        .getList(list) #error: Argument "1" must be passed with the "ref" keyword
        .getList(inout list) #this compiles fine if above line is commented out.
    
    
    def getList(list as inout List<of int>)
        trace list

class Program

    def main is shared
        has STAThread
        Application.run(WordMatcher())
Note: See TracTickets for help on using tickets.