Inferred Symbols for Test-Driven Code Completion
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Dynamic programming techniques and test-driven development face challenges in providing information on potential code when the underlying code has not yet been created, as traditional tools rely on existing code for features like auto-completion, which are not applicable in consume-first or test-first styles of programming.
Innovation Solution
The creation of data structures such as syntax trees or semantic trees with inferred nodes and symbols, generated using a learning algorithm, allows software development tools to provide information on symbols not yet defined, enabling tools to offer suggestions and auto-generate code based on usage patterns.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Measurement precision
If traditional code analysis tools are used that rely on existing code definitions, then tool accuracy is improved, but applicability to test-driven development is worsened
Solution Approach 1:
The system performs preliminary code analysis by inferring symbol definitions from usage contexts before formal definitions are written. The inference engine proactively creates tentative symbol representations based on how symbols are used in test code, allowing tools to provide assistance even before the actual code definitions exist.
Solution Approach 2:
The system uses the code itself to generate information about the code. By analyzing usage patterns, type conversions, and contextual references in the source code, the inference engine automatically derives symbol definitions without requiring external documentation or pre-existing type definitions.
2Adaptability or versatility
If code is written in consume-first style where consuming code is written before defined code, then development flexibility is improved, but ability to provide code information is worsened
Solution Approach 1:
The system performs preliminary inference to recover code information that would otherwise be lost. By analyzing usage contexts, type conversions, and operational patterns before formal definitions are written, the system reconstructs symbol information including types, methods, and properties that traditional tools would miss.
Solution Approach 2:
The system continuously refines symbol inferences by analyzing feedback from code usage patterns. As more code is written and executed, the inference engine updates its understanding of symbol definitions based on observed behavior, type conversions, and contextual relationships, progressively improving information accuracy.
3Adaptability or versatility
If dynamic typing is used with runtime type checking, then programming flexibility is improved, but potential for execution errors is worsened
Solution Approach 1:
The system performs preliminary static analysis to infer type information before runtime execution. By analyzing usage patterns, type conversions, and contextual type relationships in advance, the system creates type specifications that can be used for early error detection while preserving the flexibility of dynamic typing at runtime.
Data Source
Figure 1a
Figure 1b~1c
Figure 2
AI summary
When writing code, data structures that include inferred symbols are created based on usage of undefined symbols. As the user continues writing code, code model can be updated to represent updated information based on a learning model. Data structures including inferred symbols can be used by software development tools to provide developer help for symbols that are not yet created or are not yet bound. Inferred symbols can be visually distinguishable making the appearance of the inferred symbol information differ from actual symbol information. The appearance of information based on inferred symbols can be included within tools by activating a particular mode in a programming environment. Conversion of the inferred symbol to a real symbol may trigger the automatic compiler-generation of additional source code by a background compiler. Inferred symbols may be converted to actual symbols by activation of an option to make an inferred symbol a real symbol.