< Summary

Class:NanoCLang.Entities.Type
Assembly:NanoCLang
File(s):C:\GitLab-Runner\builds\JxAESPd8\0\chenmichael\nanoc\src\NanoCLang\Entities\Type.cs
Covered lines:1
Uncovered lines:0
Coverable lines:1
Total lines:46
Line coverage:100% (1 of 1)
Covered branches:2
Total branches:2
Branch coverage:100% (2 of 2)

Metrics

MethodBranch coverage Cyclomatic complexity Line coverage
SubType(...)100%2100%

File(s)

C:\GitLab-Runner\builds\JxAESPd8\0\chenmichael\nanoc\src\NanoCLang\Entities\Type.cs

#LineLine coverage
 1using NanoCLang.Environemnts;
 2using System.Collections.Generic;
 3
 4namespace NanoCLang.Entities {
 5    /// <summary>
 6    /// Provides a superclass for all NanoC types.
 7    /// May also include basic types that are used as refined types with trivial refinement.
 8    /// </summary>
 9    public abstract class Type : Base, ISubstitutable<Type> {
 10        /// <summary>
 11        /// Gets the size of the type in bytes.
 12        /// </summary>
 13        public abstract int Size { get; }
 14        /// <summary>
 15        /// Gets the underlying type of the current type.
 16        /// </summary>
 17        public abstract BasicType BaseType { get; }
 18        /// <summary>
 19        /// Gets a refinement that is valid for the type.
 20        /// </summary>
 21        public abstract PureExpression Refinement { get; }
 22        /// <summary>
 23        /// Checks if the type is well-formed and raises an exception if it is ill-formed.
 24        /// </summary>
 25        /// <exception cref="IllFormedException">Type is ill-formed.</exception>
 26        public abstract void WellFormed(LocalEnvironment gamma, Heap heap);
 27        /// <summary>
 28        /// Checks if the current type is a subtype of the <paramref name="other"/> type in the given environment.
 29        /// </summary>
 30        /// <param name="gamma">Environment to check the subtype in.</param>
 31        /// <param name="other">Other type to check against.</param>
 32        /// <returns><see langword="true"/> iff the current type is a subtype of the <paramref name="other"/> type.</ret
 37533        public virtual bool SubType(LocalEnvironment gamma, Type other) => this == other || ProperSubType(gamma, other);
 34        /// <summary>
 35        /// Checks if the current type is a proper subtype of the <paramref name="other"/> type in the given environment
 36        /// </summary>
 37        /// <param name="gamma">Environment to check the subtype in.</param>
 38        /// <param name="other">Other type to check against.</param>
 39        /// <returns><see langword="true"/> iff the current type is a proper subtype of the <paramref name="other"/> typ
 40        public abstract bool ProperSubType(LocalEnvironment gamma, Type other);
 41        /// <inheritdoc/>
 42        public abstract Type Replace(Substitutor sub);
 43        /// <inheritdoc/>
 44        public abstract override IEnumerable<StringFormatterToken> Tokens(CSourceFormat args);
 45    }
 46}

Methods/Properties

SubType(...)