All Downloads are FREE. Search and download functionalities are using the official Maven repository.

prompto.problem.IllegalAssignmentProblem Maven / Gradle / Ivy

package prompto.problem;

import java.util.Collections;
import java.util.Set;

import prompto.parser.ICodeSection;
import prompto.type.IType;

public class IllegalAssignmentProblem extends SyntaxProblemBase {

	Set expected;
	IType actual;
		
	public IllegalAssignmentProblem(ICodeSection section, IType expected, IType actual) {
		super(section);
		this.expected = Collections.singleton(expected);
		this.actual = actual;
	}

	public IllegalAssignmentProblem(ICodeSection section, Set expected, IType actual) {
		super(section);
		this.expected = expected;
		this.actual = actual;
	}

	@Override
	public Type getType() {
		return Type.ERROR;
	}
	
	@Override
	public String getMessage() {
		return "Illegal expression type, expected: " +  expected.toString() + ", got:" + actual.getTypeName();
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy