Skip to content

Add type inference #1652

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 101 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
101 commits
Select commit Hold shift + click to select a range
337ed96
feat: infer types for constant expressions
loki259 Apr 5, 2025
4ef9811
style: make stylistic changes to satisfy ESLint
loki259 Apr 6, 2025
746596b
test(typing): streamline the type inferencer tests using `describe.each`
loki259 Apr 7, 2025
e53e003
feat(typing): add preliminary support for expression lists and `NULL`
loki259 Apr 7, 2025
8072fe6
test(typing): add tests for unsupported expression types
loki259 Apr 7, 2025
ce1fc8c
test: add a test for empty expression lists
loki259 Apr 7, 2025
53fe22f
feat(typing): add support for complex number literals
loki259 Apr 7, 2025
18ec199
test(types): refactor tests to use tree-sitter
loki259 Apr 7, 2025
bb514bf
refactor: refactor the type representation of R data types
loki259 May 3, 2025
2eccfcd
Merge branch 'main' into 174-add-type-inference
loki259 May 4, 2025
67f9204
Merge branch 'main' into 174-add-type-inference
loki259 May 8, 2025
ebcff1e
feat(ast): add `mapAstInfo` for transforming metadata attached to nodes
loki259 May 10, 2025
9c8c4c1
Merge branch '1637-map-attached-ast-info' into 174-add-type-inference
loki259 May 10, 2025
e8f02a2
wip(typing): rework type inference to use type variables and constraints
loki259 May 10, 2025
c74a1cb
Merge branch 'main' into 174-add-type-inference
loki259 May 11, 2025
9b7e136
refactor(typing): replace '<>' with `EmptyArgument` constant
loki259 May 11, 2025
d936697
refactor(typing): rename string representation of `RDataTypeTag.Any`
loki259 May 11, 2025
ac3b105
feat-fix(typing): fix erroneous property access of `inferredType`
loki259 May 11, 2025
9710138
feat-fix(semantic-cfg): explicit onProgram visitor
EagleoutIce May 11, 2025
14913c4
refactor(ast): rework `mapAstInfo` to mutate the AST nodes in place
loki259 May 12, 2025
5339c1a
refactor(ast): define default for `downUpdater` argument of `mapAstInfo`
loki259 May 12, 2025
d00cced
feat(ast): add wrapper of `mapAstInfo` for normalized ASTs
loki259 May 12, 2025
c966fe9
Merge branch '1637-map-attached-ast-info' into 174-add-type-inference
loki259 May 12, 2025
b1b5963
refactor(typing): infer types directly on the normalized AST
loki259 May 12, 2025
a9bbff0
test(typing): add test helper for asserting types of queried subnodes
loki259 May 14, 2025
d65e243
meta(typing): rename test file to better reflect its testing domain
loki259 May 15, 2025
2427695
feat(typing): add support for variables
loki259 May 15, 2025
45a417d
refactor(typing): handle expression lists more robustly via return edges
loki259 May 19, 2025
5d631fc
refactor(typing): handle variables more robustly
loki259 May 19, 2025
76c5c1b
feat(typing): add preliminary support for functions
loki259 May 19, 2025
fa736e2
refactor(typing): handle program expression lists more robustly
loki259 May 19, 2025
919172d
feat(typing): split role of `Any` into `Any`, `Never` and `Error` types
loki259 May 21, 2025
4e230f1
Merge branch 'main' into 174-add-type-inference
loki259 May 21, 2025
31bb506
refactor(typing): remove `Special` and `Builtin` and add `Language` type
loki259 May 24, 2025
58e1bb4
feat(typing): infer types for `get` and `rm` calls
loki259 May 24, 2025
7303d55
feat(typing): infer types for loops
loki259 May 24, 2025
31616e1
feat(typing): infer types for if-then-else calls
loki259 May 24, 2025
09bd3f9
feat(typing): infer types for list and vector constructors
loki259 May 24, 2025
a3d6f4e
feat(typing): infer types for `quote` and `eval` calls
loki259 May 24, 2025
5b1734d
test(typing): split up tests into multiple test files
loki259 May 24, 2025
3c88cfa
refactor(typing): refactor counting of vertices flowing into loop exits
loki259 May 24, 2025
c36973e
feat-fix(cfg): correct spelling of origin id for repeat loops
loki259 May 24, 2025
9cd59e9
feat-fix(cfg): link for loop cfg exits using `end` instead of `exit`
loki259 May 24, 2025
393080f
Merge branch '1676-misspelled-origin-identifier-for-repeat-loops' int…
loki259 May 24, 2025
fa54a37
Merge branch '1677-loop-cfg-vertices-use-exit-instead-of-end-field' i…
loki259 May 24, 2025
38238af
build-fix(typing): fix merge issues
loki259 May 24, 2025
5aad303
test(typing): test type inference for loops
loki259 May 24, 2025
afccc29
Merge remote-tracking branch 'origin/main' into 174-add-type-inference
loki259 May 26, 2025
3222f31
refactor(typing): refactor `onDefaultFunctionCall`
loki259 May 26, 2025
c8bbeca
Merge remote-tracking branch 'origin/main' into 174-add-type-inference
loki259 May 26, 2025
41b166c
feat(typing): add support for NULL constants
loki259 May 26, 2025
24a4e33
test(typing): add tests for currently inferrable builtin functions
loki259 May 26, 2025
8720315
feat-fix(typing): fix type inference for `quote` calls
loki259 May 26, 2025
0c21cda
Merge remote-tracking branch 'origin/main' into 174-add-type-inference
loki259 May 29, 2025
0b15bdd
feat-fix(typing): fix merge issues
loki259 May 29, 2025
40e47cf
refactor(typing): handle missing arguments in `if` calls more robustly
loki259 May 29, 2025
526ffe3
test(typing): add tests for typing of `if` calls
loki259 May 29, 2025
fa66032
feat(typing): add support for function argument and return types
loki259 May 29, 2025
a07b142
Merge remote-tracking branch 'origin/main' into 174-add-type-inference
loki259 Jun 1, 2025
7fcd64f
build-fix(typing): resolve merge issues
loki259 Jun 1, 2025
b660b7b
test(typing): update test cases for loops and conditionals
loki259 Jun 1, 2025
92f3f71
Add A Query Type For Querying Data Types (#1707)
loki259 Jun 1, 2025
9693b40
feat(typing): include dead code analysis passes when extracting the cfg
loki259 Jun 1, 2025
473ee21
Merge branch '174-add-type-inference' of github.com:flowr-analysis/fl…
loki259 Jun 1, 2025
dae9dca
Merge remote-tracking branch 'origin/main' into 174-add-type-inference
loki259 Jun 5, 2025
6dab576
test(typing): edit tests
loki259 Jun 5, 2025
a676aad
feat(typing): properly track conflicting types within `RErrorType`
loki259 Jun 5, 2025
6f65c7e
refactor(typing): refactor typing of if-then-else calls
loki259 Jun 6, 2025
f7bb39d
refactor(typing): remove `Any` and `Never` and introduce `Unknown` type
loki259 Jun 8, 2025
8565e11
feat-fix(typing): fix typing of `get` calls
loki259 Jun 8, 2025
d21fe03
feat(typing): make list datatypes more sophisticated
loki259 Jun 12, 2025
ef3e14d
feat(typing): infer types for list elements
loki259 Jun 12, 2025
03f2551
feat(typing): make function and list type inference more sophisticated
loki259 Jun 12, 2025
fe95551
test-fix(typing): fix list typing test
loki259 Jun 12, 2025
5e57e4c
feat-fix(typing): ignore positional parameters occuring after `...`
loki259 Jun 12, 2025
2d6ad1c
feat(typing): pretty-print list types
loki259 Jun 13, 2025
920f754
feat(typing): add discriminator functions for vector and compound types
loki259 Jun 13, 2025
6098201
feat(typing): implement preliminary inference for access calls
loki259 Jun 13, 2025
ae89b42
refactor(typing): only infer `RIntegerType` for marked number constants
loki259 Jun 13, 2025
f474473
refactor(typing): refactor test files
loki259 Jun 13, 2025
aa7208d
Merge remote-tracking branch 'origin/main' into 174-add-type-inference
loki259 Jun 15, 2025
263309d
refactor(typing): simplify list types due to constraints of unification
loki259 Jun 17, 2025
7768229
refactor(typing): refactor handling of argument nodes
loki259 Jun 19, 2025
9e2cff4
refactor(typing): change traversal order to visit call arguments first
loki259 Jun 19, 2025
3b1519e
refactor(typing): use sets to track conflicting types in error types
loki259 Jun 19, 2025
d2c1ea5
wip(typing): add an enumeration of R's base types
loki259 Jun 19, 2025
9ca8dea
feat-fix(typing): remove failing guard disallowing calls without targets
loki259 Jun 19, 2025
730fa56
refactor(ast): refactor mapNormalizedAstInfo to use NormalizedAst.idMap
loki259 Jun 19, 2025
7e44d62
Merge branch '1637-map-attached-ast-info' into 174-add-type-inference
loki259 Jun 19, 2025
1a75999
feat-fix(typing): fix merge issues
loki259 Jun 19, 2025
ccfc943
Merge remote-tracking branch 'origin/main' into 174-add-type-inference
loki259 Jun 19, 2025
83b3169
feat-fix(ast-map): do not map virtual nodes
EagleoutIce Jun 19, 2025
0f394cb
refactor: add test that i commented out
EagleoutIce Jun 19, 2025
c0ca7b7
Merge branch '174-add-type-inference' of github.com:flowr-analysis/fl…
loki259 Jun 19, 2025
b58071c
test-fix(typing): fix expected type due to dead code elimination updates
loki259 Jun 19, 2025
38af6c5
Merge remote-tracking branch 'origin/main' into 174-add-type-inference
loki259 Jun 19, 2025
340d203
refactor(datatype-query): reuse typed AST for all criteria
loki259 Jun 19, 2025
be5e30d
lint-fix(datatype-query): remove redundant space
loki259 Jun 19, 2025
63177c9
test-fix(typing): remove `only` specifier from test
loki259 Jun 19, 2025
a6a369c
Merge branch '1765-optimize-datatype-query' of github.com:flowr-analy…
loki259 Jun 19, 2025
90b774b
refactor(datatype-query): reuse typed AST for all criteria (#1766)
loki259 Jun 19, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions src/documentation/print-query-wiki.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import { Q } from '../search/flowr-search-builder';
import { VertexType } from '../dataflow/graph/vertex';
import { getTypesFromFolderAsMermaid, shortLink } from './doc-util/doc-types';
import path from 'path';
import { executeDatatypeQuery } from '../queries/catalog/datatype-query/datatype-query-executor';
import { executeControlFlowQuery } from '../queries/catalog/control-flow-query/control-flow-query-executor';
import { printCfgCode } from './doc-util/doc-cfg';

Expand Down Expand Up @@ -483,6 +484,30 @@ This query replaces the old [\`request-slice\`](${FlowrWikiBaseRef}/Interface#me
}
});


registerQueryDocumentation('datatype', {
name: 'Datatype Query',
type: 'active',
shortDescription: 'Returns all datatypes for syntactic elements (or the type for a criterion).',
functionName: executeDatatypeQuery.name,
functionFile: '../queries/catalog/datatype-query/datatype-query-executor.ts',
buildExplanation: async(shell: RShell) => {
const exampleCode = 'x <- 1\ny <- 2\nx';
return `
This query returns the datatypes of syntactic elements in the code.
To exemplify the capabilities, consider the following code:
${codeBlock('r', exampleCode)}
To see the type of the variable \`x\`, you can use the following query:
${
await showQuery(shell, exampleCode, [{
type: 'datatype',
criterion: '3@x'
}], { showCode: false })
}
`;
}
});

registerQueryDocumentation('dependencies', {
name: 'Dependencies Query',
type: 'active',
Expand Down
30 changes: 30 additions & 0 deletions src/queries/catalog/datatype-query/datatype-query-executor.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import type { DatatypeQuery, DatatypeQueryResult } from './datatype-query-format';
import { log } from '../../../util/log';
import type { BasicQueryData } from '../../base-query-format';
import type { NormalizedAst, ParentInformation } from '../../../r-bridge/lang-4.x/ast/model/processing/decorate';
import { slicingCriterionToId } from '../../../slicing/criterion/parse';
import { inferDataTypes } from '../../../typing/infer';

export function executeDatatypeQuery({ dataflow, ast }: BasicQueryData, queries: readonly DatatypeQuery[]): DatatypeQueryResult {
const start = Date.now();
const result: DatatypeQueryResult['inferredTypes'] = {};
const typedAst = inferDataTypes(ast as NormalizedAst<ParentInformation & { typeVariable?: undefined }>, dataflow);

for(const { criterion } of queries) {
if(result[criterion ?? '1:1'] !== undefined) {
log.warn('Duplicate criterion in datatype query:', criterion);
continue;
}
const node = criterion !== undefined ? typedAst.idMap.get(slicingCriterionToId(criterion, typedAst.idMap)) : typedAst.ast;
if(node === undefined) {
log.warn('Criterion not found in normalized AST:', criterion);
continue;
}
result[criterion ?? '1:1'] = node.info.inferredType;
}

return {
'.meta': { timing: Date.now() - start },
inferredTypes: result
};
}
42 changes: 42 additions & 0 deletions src/queries/catalog/datatype-query/datatype-query-format.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import type { BaseQueryFormat, BaseQueryResult } from '../../base-query-format';
import type { SingleSlicingCriterion } from '../../../slicing/criterion/parse';
import type { QueryResults, SupportedQuery } from '../../query';
import { bold } from '../../../util/text/ansi';
import { printAsMs } from '../../../util/text/time';
import Joi from 'joi';
import { executeDatatypeQuery } from './datatype-query-executor';

import { asciiDataType } from '../../query-print';
import type { RDataType } from '../../../typing/types';

/**
* Calculates the inferred data type for the given criterion.
*/
export interface DatatypeQuery extends BaseQueryFormat {
readonly type: 'datatype';
readonly criterion?: SingleSlicingCriterion;
}

export interface DatatypeQueryResult extends BaseQueryResult {
/** Maps each criterion to the inferred data type, duplicates are ignored. */
readonly inferredTypes: Record<SingleSlicingCriterion, RDataType>;
}

export const DatatypeQueryDefinition = {
executor: executeDatatypeQuery,
asciiSummarizer: (formatter, _processed, queryResults, result) => {
const out = queryResults as QueryResults<'datatype'>['datatype'];
result.push(`Query: ${bold('datatype', formatter)} (${printAsMs(out['.meta'].timing, 0)})`);
for(const [criterion, inferredType] of Object.entries(out.inferredTypes)) {
result.push(` ╰ ${criterion}: {${asciiDataType(inferredType)}}`);
}
return true;
},
flattenInvolvedNodes: () => {
return [];
},
schema: Joi.object({
type: Joi.string().valid('datatype').required().description('The type of the query.'),
criterion: Joi.string().optional().description('The slicing criterion of the node to get the inferred data type for.')
}).description('Datatype query used to extract the inferred data type for a node in the normalized AST')
} as const satisfies SupportedQuery<'datatype'>;
11 changes: 11 additions & 0 deletions src/queries/query-print.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import type { CallContextQuerySubKindResult } from './catalog/call-context-query
import type { BaseQueryMeta, BaseQueryResult } from './base-query-format';
import { printAsMs } from '../util/text/time';
import { isBuiltIn } from '../dataflow/environments/built-in';
import { RDataTypeTag, type RDataType } from '../typing/types';

function nodeString(nodeId: NodeId | { id: NodeId, info?: object}, formatter: OutputFormatter, processed: PipelineOutput<typeof DEFAULT_DATAFLOW_PIPELINE>): string {
const isObj = typeof nodeId === 'object' && nodeId !== null && 'id' in nodeId;
Expand Down Expand Up @@ -76,6 +77,16 @@ export function summarizeIdsIfTooLong(formatter: OutputFormatter, ids: readonly
return formatter === markdownFormatter ? textWithTooltip(acc, JSON.stringify(ids)) : acc;
}

export function asciiDataType(type: RDataType): string {
if(type.tag === RDataTypeTag.Function) {
return `Function(${type.parameterTypes.entries().toArray().map(([key, type]) => `${key}: ${asciiDataType(type)}`).join(', ')}) -> ${asciiDataType(type.returnType)}`;
} else if(type.tag === RDataTypeTag.List) {
return `List(${asciiDataType(type.elementType)})`;
} else {
return type.tag;
}
}

export function asciiSummaryOfQueryResult(formatter: OutputFormatter, totalInMs: number, results: QueryResults<SupportedQueryTypes>, processed: PipelineOutput<typeof DEFAULT_DATAFLOW_PIPELINE>): string {
const result: string[] = [];

Expand Down
3 changes: 3 additions & 0 deletions src/queries/query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ import { OriginQueryDefinition } from './catalog/origin-query/origin-query-forma
import type { LinterQuery } from './catalog/linter-query/linter-query-format';
import { LinterQueryDefinition } from './catalog/linter-query/linter-query-format';
import type { NodeId } from '../r-bridge/lang-4.x/ast/model/processing/node-id';
import { DatatypeQueryDefinition, type DatatypeQuery } from './catalog/datatype-query/datatype-query-format';
import type { ControlFlowQuery } from './catalog/control-flow-query/control-flow-query-format';
import { ControlFlowQueryDefinition } from './catalog/control-flow-query/control-flow-query-format';

Expand All @@ -57,6 +58,7 @@ export type Query = CallContextQuery
| DataflowClusterQuery
| StaticSliceQuery
| LineageQuery
| DatatypeQuery
| DependenciesQuery
| LocationMapQuery
| HappensBeforeQuery
Expand Down Expand Up @@ -97,6 +99,7 @@ export const SupportedQueries = {
'dataflow-cluster': ClusterQueryDefinition,
'static-slice': StaticSliceQueryDefinition,
'lineage': LineageQueryDefinition,
'datatype': DatatypeQueryDefinition,
'dependencies': DependenciesQueryDefinition,
'location-map': LocationMapQueryDefinition,
'search': SearchQueryDefinition,
Expand Down
2 changes: 1 addition & 1 deletion src/r-bridge/lang-4.x/ast/model/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export type NoInfo = object;
* Will be used to reconstruct the source of the given element in the R-ast.
* This will not be part of most comparisons as it is mainly of interest to the reconstruction of R code.
*/
interface Source {
export interface Source {
/**
* The range is different from the assigned {@link Location} as it refers to the complete source range covered by the given
* element.
Expand Down
66 changes: 65 additions & 1 deletion src/r-bridge/lang-4.x/ast/model/processing/decorate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* @module
*/

import type { NoInfo, RNode } from '../model';
import type { NoInfo, RNode, Source } from '../model';
import { guard } from '../../../../../util/assert';
import type { SourceRange } from '../../../../../util/range';
import { BiMap } from '../../../../../util/collections/bimap';
Expand Down Expand Up @@ -463,3 +463,67 @@ function createFoldForFunctionArgument<OtherInfo>(info: FoldInfo<OtherInfo>) {
return decorated;
};
}


export function mapAstInfo<OldInfo, Down, NewInfo>(ast: RNode<OldInfo>, down: Down, infoMapper: (node: RNode<OldInfo>, down: Down) => NewInfo, downUpdater: (node: RNode<OldInfo>, down: Down) => Down = (_node, down) => down): RNode<NewInfo> {
const fullInfoMapper = (node: RNode<OldInfo>, down: Down): NewInfo & Source => {
const sourceInfo = {
...(node.info.fullRange !== undefined ? { fullRange: node.info.fullRange } : {}),
...(node.info.fullLexeme !== undefined ? { fullLexeme: node.info.fullLexeme } : {}),
...(node.info.additionalTokens !== undefined ? { additionalTokens: node.info.additionalTokens } : {}),
...(node.info.file !== undefined ? { file: node.info.file } : {})
};
const mappedInfo = infoMapper(node, down);
return { ...sourceInfo, ...mappedInfo };
};

function updateInfo(n: RNode<OldInfo>, down: Down): RNode<NewInfo> {
(n.info as NewInfo) = fullInfoMapper(n, down);
return n as unknown as RNode<NewInfo>;
}

return foldAstStateful(ast, down, {
down: downUpdater,
foldNumber: updateInfo,
foldString: updateInfo,
foldLogical: updateInfo,
foldSymbol: updateInfo,
foldAccess: (node, _name, _access, down) => updateInfo(node, down),
foldBinaryOp: (op, _lhs, _rhs, down) => updateInfo(op, down),
foldPipe: (op, _lhs, _rhs, down) => updateInfo(op, down),
foldUnaryOp: (op, _operand, down) => updateInfo(op, down),
loop: {
foldFor: (loop, _variable, _vector, _body, down) => updateInfo(loop, down),
foldWhile: (loop, _condition, _body, down) => updateInfo(loop, down),
foldRepeat: (loop, _body, down) => updateInfo(loop, down),
foldNext: (next, down) => updateInfo(next, down),
foldBreak: (next, down) => updateInfo(next, down),
},
other: {
foldComment: (comment, down) => updateInfo(comment, down),
foldLineDirective: (comment, down) => updateInfo(comment, down),
},
foldIfThenElse: (ifThenExpr, _condition, _then, _otherwise, down ) =>
updateInfo(ifThenExpr, down),
foldExprList: (exprList, _grouping, _expressions, down) => updateInfo(exprList, down),
functions: {
foldFunctionDefinition: (definition, _parameters, _body, down) => updateInfo(definition, down),
/** folds named and unnamed function calls */
foldFunctionCall: (call, _functionNameOrExpression, _args, down) => updateInfo(call, down),
/** The `name` is `undefined` if the argument is unnamed, the value, if we have something like `x=,...` */
foldArgument: (argument, _name, _value, down) => updateInfo(argument, down),
/** The `defaultValue` is `undefined` if the argument was not initialized with a default value */
foldParameter: (parameter, _name, _defaultValue, down) => updateInfo(parameter, down)
}
});
}

export function mapNormalizedAstInfo<OldInfo extends ParentInformation, NewInfo>(normalizedAst: NormalizedAst<OldInfo>, infoMapper: (node: RNode<OldInfo>) => NewInfo): NormalizedAst<NewInfo> {
for(const [id, node] of normalizedAst.idMap.entries()) {
if(id === node.info.id) { // we skip virtual nodes
(node.info as unknown as NewInfo) = infoMapper(node);
}
}

return normalizedAst as unknown as NormalizedAst<NewInfo>;
}
56 changes: 56 additions & 0 deletions src/typing/base-types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
import { RDataTypeTag } from './types';

/* eslint-disable @typescript-eslint/naming-convention */
export enum RBaseType {
NILSXP = 'NULL',
LGLSXP = 'logical',
INTSXP = 'integer',
REALSXP = 'double',
CPLXSXP = 'complex',
STRSXP = 'character',
VECSXP = 'list',
RAWSXP = 'raw',
CLOSXP = 'closure',
SPECIALSXP = 'special',
BUILTINSXP = 'builtin',
ENVSXP = 'environment',
// S4SXP = 'S4',
SYMSXP = 'symbol',
LANGSXP = 'language',
// LISTSXP = 'pairlist',
EXPRSXP = 'expression',
// EXTPTRSXP = 'externalptr',
// WEAKREFSXP = 'weakref',
// BCODESXP = 'bytecode',
// PROMSXP = 'promise',
// DOTSXP = '...',
// ANYSXP = 'any',
}

export function baseTypeToDataTypeTag(baseType: RBaseType): RDataTypeTag {
switch(baseType) {
case RBaseType.NILSXP: return RDataTypeTag.Null;
case RBaseType.LGLSXP: return RDataTypeTag.Logical;
case RBaseType.INTSXP: return RDataTypeTag.Integer;
case RBaseType.REALSXP: return RDataTypeTag.Double;
case RBaseType.CPLXSXP: return RDataTypeTag.Complex;
case RBaseType.STRSXP: return RDataTypeTag.String;
case RBaseType.VECSXP: return RDataTypeTag.List;
case RBaseType.RAWSXP: return RDataTypeTag.Raw;
case RBaseType.CLOSXP: return RDataTypeTag.Function;
case RBaseType.SPECIALSXP: return RDataTypeTag.Function; // Special functions are a kind of function
case RBaseType.BUILTINSXP: return RDataTypeTag.Function; // Builtin functions are a kind of function
case RBaseType.ENVSXP: return RDataTypeTag.Environment;
// case RBaseType.S4SXP: return RDataTypeTag.Unknown; // Not yet supported
case RBaseType.SYMSXP: return RDataTypeTag.Language; // Symbols are a kind of language object
case RBaseType.LANGSXP: return RDataTypeTag.Language;
// case RBaseType.LISTSXP: return RDataTypeTag.List; // Not supported
case RBaseType.EXPRSXP: return RDataTypeTag.Language; // Expressions are a kind of language object
// case RBaseType.EXTPTRSXP: return RDataTypeTag.Unknown; // Not supported
// case RBaseType.WEAKREFSXP: return RDataTypeTag.Unknown; // Not supported
// case RBaseType.BCODESXP: return RDataTypeTag.Unknown; // Not supported
// case RBaseType.PROMSXP: return RDataTypeTag.Unknown; // Not supported
// case RBaseType.DOTSXP: return RDataTypeTag.Language; // Not included in the type system
// case RBaseType.ANYSXP: return RDataTypeTag.Unknown; // Not supported
}
}
Loading
Loading