// Code generated by "go test -run=Generate -write=all"; DO NOT EDIT.
// Source: ../../cmd/compile/internal/types2/recording.go

// Copyright 2024 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

// This file implements recording of type information
// in the types2.Info maps.

package types

import (
	
	
)

func ( *Checker) ( *operand) {
	// convert x into a user-friendly set of values
	// TODO(gri) this code can be simplified
	var  Type
	var  constant.Value
	switch .mode {
	case invalid:
		 = Typ[Invalid]
	case novalue:
		 = (*Tuple)(nil)
	case constant_:
		 = .typ
		 = .val
	default:
		 = .typ
	}
	assert(.expr != nil &&  != nil)

	if isUntyped() {
		// delay type and value recording until we know the type
		// or until the end of type checking
		.rememberUntyped(.expr, false, .mode, .(*Basic), )
	} else {
		.recordTypeAndValue(.expr, .mode, , )
	}
}

func ( *Checker) () {
	if !debug && !.recordTypes() {
		return // nothing to do
	}

	for ,  := range .untyped {
		if debug && isTyped(.typ) {
			.dump("%v: %s (type %s) is typed", .Pos(), , .typ)
			panic("unreachable")
		}
		.recordTypeAndValue(, .mode, .typ, .val)
	}
}

func ( *Checker) ( ast.Expr,  operandMode,  Type,  constant.Value) {
	assert( != nil)
	assert( != nil)
	if  == invalid {
		return // omit
	}
	if  == constant_ {
		assert( != nil)
		// We check allBasic(typ, IsConstType) here as constant expressions may be
		// recorded as type parameters.
		assert(!isValid() || allBasic(, IsConstType))
	}
	if  := .Types;  != nil {
		[] = TypeAndValue{, , }
	}
	.recordTypeAndValueInSyntax(, , , )
}

func ( *Checker) ( ast.Expr,  *Signature) {
	// f must be a (possibly parenthesized, possibly qualified)
	// identifier denoting a built-in (including unsafe's non-constant
	// functions Add and Slice): record the signature for f and possible
	// children.
	for {
		.recordTypeAndValue(, builtin, , nil)
		switch p := .(type) {
		case *ast.Ident, *ast.SelectorExpr:
			return // we're done
		case *ast.ParenExpr:
			 = .X
		default:
			panic("unreachable")
		}
	}
}

// recordCommaOkTypes updates recorded types to reflect that x is used in a commaOk context
// (and therefore has tuple type).
func ( *Checker) ( ast.Expr,  []*operand) {
	assert( != nil)
	assert(len() == 2)
	if [0].mode == invalid {
		return
	}
	,  := [0].typ, [1].typ
	assert(isTyped() && isTyped() && (allBoolean() ||  == universeError))
	if  := .Types;  != nil {
		for {
			 := []
			assert(.Type != nil) // should have been recorded already
			 := .Pos()
			.Type = NewTuple(
				NewVar(, .pkg, "", ),
				NewVar(, .pkg, "", ),
			)
			[] = 
			// if x is a parenthesized expression (p.X), update p.X
			,  := .(*ast.ParenExpr)
			if  == nil {
				break
			}
			 = .X
		}
	}
	.recordCommaOkTypesInSyntax(, , )
}

// recordInstance records instantiation information into check.Info, if the
// Instances map is non-nil. The given expr must be an ident, selector, or
// index (list) expr with ident or selector operand.
//
// TODO(rfindley): the expr parameter is fragile. See if we can access the
// instantiated identifier in some other way.
func ( *Checker) ( ast.Expr,  []Type,  Type) {
	 := instantiatedIdent()
	assert( != nil)
	assert( != nil)
	if  := .Instances;  != nil {
		[] = Instance{newTypeList(), }
	}
}

func ( *Checker) ( *ast.Ident,  Object) {
	assert( != nil)
	if  := .Defs;  != nil {
		[] = 
	}
}

func ( *Checker) ( *ast.Ident,  Object) {
	assert( != nil)
	assert( != nil)
	if  := .Uses;  != nil {
		[] = 
	}
}

func ( *Checker) ( ast.Node,  Object) {
	assert( != nil)
	assert( != nil)
	if  := .Implicits;  != nil {
		[] = 
	}
}

func ( *Checker) ( *ast.SelectorExpr,  SelectionKind,  Type,  Object,  []int,  bool) {
	assert( != nil && ( == nil || len() > 0))
	.recordUse(.Sel, )
	if  := .Selections;  != nil {
		[] = &Selection{, , , , }
	}
}

func ( *Checker) ( ast.Node,  *Scope) {
	assert( != nil)
	assert( != nil)
	if  := .Scopes;  != nil {
		[] = 
	}
}