The depth of the type seen as a tree.

  • A -> 1
  • G[A] -> 2
  • H[A, B] -> 2
  • H[G[A], B] -> 3

Formal types have a depth of 1. Only MClassType and MFormalType nodes are counted.

Property definitions

nitc $ MType :: depth
	# The depth of the type seen as a tree.
	#
	# * A -> 1
	# * G[A] -> 2
	# * H[A, B] -> 2
	# * H[G[A], B] -> 3
	#
	# Formal types have a depth of 1.
	# Only `MClassType` and `MFormalType` nodes are counted.
	fun depth: Int
	do
		return 1
	end
src/model/model.nit:1224,2--1236,4

nitc $ MProxyType :: depth
	redef fun depth do return self.mtype.depth
src/model/model.nit:1807,2--43

nitc $ MSignature :: depth
	redef fun depth
	do
		var dmax = 0
		var t = self.return_mtype
		if t != null then dmax = t.depth
		for p in mparameters do
			var d = p.mtype.depth
			if d > dmax then dmax = d
		end
		return dmax + 1
	end
src/model/model.nit:1983,2--1993,4

nitc $ MGenericType :: depth
	redef fun depth
	do
		var dmax = 0
		for a in self.arguments do
			var d = a.depth
			if d > dmax then dmax = d
		end
		return dmax + 1
	end
src/model/model.nit:1485,2--1493,4