module checkNoOverSpecificRunsOn {
    
    //global const for validation
    const someType someGlobalConst := 21;

	//component in question
    type component someComponent {
        var someType someVarName := 2;
        var someType someOtherVarName := 2, someAnotherVarName := 4;
        var charstring someCharStringVar := "xyz";
        var template someType someTemplateVarName := 3;
        const someType someConstName := 1;
        const integer someIntegerConstName := 42;
        const someOtherType someConstName2 := someModuleParameterName2, someConstName3 := someModuleParameterName3;
        timer someTimer;
        port somePortType somePortInstance;
    }

	type component someComponent2 extends someComponent{
        port somePortType somePortInstance2;
		
	}

	//good
    function someFunction ()
    runs on someComponent {
        //some references to component definitions here
        someTimer.start ( 10.0 );
    }

	//bad
    function someOverSpecificFunction ()
    runs on someComponent {
		//ay(); //this will make it valid
		//wrapperfunction(); //this will make it valid
		wrapperFunction(); //unresolvable due to a typo - proper error message provided 
    //no references to component definitions here 
    }

	//irrelevant
    function someGenericFunction () runs on someComponent{
		somePortInstance.send("x");
    //no relation
    }



    //good 
    //a tricky example with a referenced function that uses the relevant fields
    //wraper function
    function wrapperfunction ()
    runs on someComponent {

        //function that uses the component definitions
        someFunction ();
    }

	//bad
    testcase tcx ()
    runs on someComponent {
		//ay(); //this will make it valid
    }

	//good
	//tricky wrapper example
    altstep ax ()
    runs on someComponent {
    	var integer a := someFunction();
        [] ay ()
        [] ay ()
    }

	//good
    altstep ay ()
    runs on someComponent {
    	var integer a := someFunction();	

        [] someTimer.timeout {
			wrapperfunction();
        }
    }

	//tricky cyclic call sequences
	function f1() runs on someComponent{
		f2();
		f3()
	}
	function f2() runs on someComponent{
		f1()
		f4()
	}
	function f3() runs on someComponent{
		f2()
	}
	function f4() runs on someComponent{
	
	}
}