Skip to content
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

String Analysis #1

Open
wants to merge 593 commits into
base: develop
Choose a base branch
from
Open

String Analysis #1

wants to merge 593 commits into from

Conversation

errt
Copy link
Collaborator

@errt errt commented Apr 12, 2021

Implementation of the string analysis (the interprocedural as well as the intraprocedural variant).

Original PR by PatrickN.

Copy link
Collaborator Author

@errt errt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Restored original review by @florian-kuebler

@johannesduesing johannesduesing self-assigned this Jan 27, 2023
@johannesduesing johannesduesing marked this pull request as draft January 27, 2023 09:38
johannesduesing pushed a commit that referenced this pull request Feb 1, 2023
Former-commit-id: 614a9d487563eced85c8c307f4e569848382a417
*/
package object string {

type HighSoundness = Boolean
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still not sure what the benefit of having this even as a type alias is. Why not just use boolean (note that, at least in the past, Scala tended to introduce lots of unnecessary boxing when using type aliases of primitive types).

@@ -43,8 +48,10 @@ object StringConstancyLevel {
Dynamic
} else if (level1 == PartiallyConstant || level2 == PartiallyConstant) {
PartiallyConstant
} else {
} else if (level1 == Constant || level2 == Constant) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this method be called meet?

@@ -65,7 +72,9 @@ object StringConstancyLevel {
level1: StringConstancyLevel,
level2: StringConstancyLevel
): StringConstancyLevel = {
if (level1 == PartiallyConstant || level2 == PartiallyConstant) {
if (level1 == Invalid || level2 == Invalid) {
PartiallyConstant
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks wrong. If both are Invalid, shouldn't the result be Invalid as well?

* Checks whether the given type is supported by the field read analysis, i.e. if it may contain values desirable
* AND resolvable by the string analysis as a whole.
*/
private def isSupportedType(fieldType: FieldType): Boolean = fieldType.isBaseType || fieldType == ObjectType.String
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this can even use eq instead of ==

/**
* @author Maximilian Rüsch
*/
trait UniversalStringConfig {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe rename to sth. like StringAnalysisConfig?

@maximilianruesch maximilianruesch marked this pull request as ready for review September 23, 2024 22:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants