<commit_before>// Copyright 2011 <NAME>. All Rights Reserved.
// Author: <EMAIL> (<NAME>)
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package oglemock

import (
	"errors"
	"fmt"
	"reflect"
)

// Return creates an Action that simply returns the values passed to Return as
// arguments. You should make sure that these values are correctly typed to be
// return values for the mock method.
//
// The following special cases apply. Given an argument x to return and a
// corresponding type T in the method's signature:
//
//  *  If T is any numeric type, x may be an int that is in-range for that
//     type. This facilities using raw integer constants: Return(17).
//
//  *  If T is a floating-point or complex number type, x may be a float64.
//     This facilities using raw floating-point constants: Return(17.5).
//
//  *  If T is a complex number type, x may be a complex128. This facilities
//     using raw complex constants: Return(17+2i).
//
//  *  If T is an interface type, x may be any value that implements T
//     (including nil).
//
func Return(vals ...interface{}) Action {
	return &returnAction{vals}
}

type returnAction struct {
	returnVals []interface{}
}

func (a *returnAction) Invoke(vals []interface{}) []interface{} {
	return a.returnVals
}

func (a *returnAction) CheckType(signature reflect.Type) error {
	// Check the length of the return value.
	numOut := signature.NumOut()
	numVals := len(a.returnVals)

	if numOut != numVals {
		return errors.New(<commit_msg>Again revised the semantics of Return.<commit_after>// Copyright 2011 <NAME>. All Rights Reserved.
// Author: <EMAIL> (<NAME>)
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package oglemock

import (
	"errors"
	"fmt"
	"reflect"
)

// Return creates an Action that returns the values passed to Return as
// arguments, after suitable legal type conversions. The following rules apply.
// Given an argument x to Return and a corresponding type T in the method's
// signature, at least one of the following must hold:
//
//  *  x is assignable to T. (See "Assignability" in the language spec.)
//
//  *  T is any numeric type, and x is an int that is in-range for that type.
//     This facilities using raw integer constants: Return(17).
//
//  *  T is a floating-point or complex number type, and x is a float64.  This
//     facilities using raw floating-point constants: Return(17.5).
//
//  *  T is a complex number type, and x is a complex128. This facilities using
//     raw complex constants: Return(17+2i).
//
func Return(vals ...interface{}) Action {
	return &returnAction{vals}
}

type returnAction struct {
	returnVals []interface{}
}

func (a *returnAction) Invoke(vals []interface{}) []interface{} {
	return a.returnVals
}

func (a *returnAction) CheckType(signature reflect.Type) error {
	// Check the length of the return value.
	numOut := signature.NumOut()
	numVals := len(a.returnVals)

	if numOut != numVals {
		return errors.New(
{'fraction_non_alphanumeric': 0.10388300554715078, 'fraction_numerical': 0.01059001512859304, 'mean_word_length': 3.3307860262008733, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3451086', 'n_tokens_mistral': 1131, 'n_tokens_neox': 1093, 'n_words': 523}