6 Commits

Author SHA1 Message Date
NoName11234
211721e09f fixed missing oderConstraints 2024-05-23 10:16:02 +02:00
NoName11234
5c5d4ff272 small fixes for scalark3 test 2024-05-23 09:42:10 +02:00
NoName11234
b228647b84 implemented scalark3 test 2024-05-23 09:26:25 +02:00
NoName11234
186fac510b added matrixk2 test 2024-05-17 14:44:45 +02:00
NoName11234
e070787867 implemented scalark2test 2024-05-15 15:45:07 +02:00
NoName11234
d2b28ea917 added matrix test 2024-04-28 08:58:40 +02:00

View File

@@ -1,10 +1,13 @@
package de.dhbwstuttgart.typeinference.unify.model;
import java.io.File;
import java.io.FileWriter;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Random;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import de.dhbwstuttgart.typeinference.unify.distributeVariance;
import de.dhbwstuttgart.typeinference.unify.interfaces.IFiniteClosure;
@@ -20,7 +23,7 @@ public final class PlaceholderType extends UnifyType{
* Static list containing the names of all existing placeholders.
* Used for generating fresh placeholders.
*/
public static final Set<String> EXISTING_PLACEHOLDERS = ConcurrentHashMap.newKeySet();
public static final ArrayList<String> EXISTING_PLACEHOLDERS = new ArrayList<String>();
/**
* Prefix of auto-generated placeholder names.
@@ -93,7 +96,7 @@ public final class PlaceholderType extends UnifyType{
* A user could later instantiate a type using the same name that is equivalent to this type.
* @return A fresh placeholder type.
*/
public static PlaceholderType freshPlaceholder() {
public synchronized static PlaceholderType freshPlaceholder() {
String name = nextName + (char) (rnd.nextInt(22) + 97); // Returns random char between 'a' and 'z'
// Add random chars while the name is in use.
while(EXISTING_PLACEHOLDERS.contains(name)) {